react-native-screens 1.0.0-alpha.22 → 1.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/android/build.gradle +9 -6
- package/android/src/main/java/com/swmansion/rnscreens/LifecycleHelper.java +4 -8
- package/android/src/main/java/com/swmansion/rnscreens/Screen.java +5 -4
- package/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java +5 -7
- package/ios/RNScreens.xcodeproj/project.pbxproj +170 -1
- package/package.json +4 -2
- package/src/screens.d.ts +2 -2
- package/src/screens.native.js +58 -26
- package/src/screens.web.js +97 -3
- package/ios/RNScreens.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RNScreens.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/RNScreens.xcodeproj/project.xcworkspace/xcuserdata/mdk.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNScreens.xcodeproj/xcuserdata/mdk.xcuserdatad/xcschemes/xcschememanagement.plist +0 -29
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@ Read usage guide depending on if you are [using Expo](#usage-in-expo-with-react-
|
|
|
9
9
|
|
|
10
10
|
## Usage with [react-navigation](https://github.com/react-navigation/react-navigation) (without Expo)
|
|
11
11
|
|
|
12
|
-
Screens support is built into [
|
|
12
|
+
Screens support is built into [react-navigation](https://github.com/react-navigation/react-navigation) starting from version [2.14.0](https://github.com/react-navigation/react-navigation/releases/tag/2.14.0) for all the different navigator types (stack, tab, drawer, etc). We plan on adding it to other navigators in near future.
|
|
13
13
|
|
|
14
|
-
To
|
|
14
|
+
To configure react-navigation to use screens instead of plain RN Views for rendering screen views, follow the steps below:
|
|
15
15
|
|
|
16
16
|
1. Add this library as a depedency to your project:
|
|
17
17
|
```
|
|
@@ -142,7 +142,7 @@ In order for your native view on iOS to be notified when its parent navigation c
|
|
|
142
142
|
}
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
You can check our example app for a fully functional demo see [RNSSampleLifecycleAwareView.m](https://github.com/kmagiera/react-native-screens/blob/master
|
|
145
|
+
You can check our example app for a fully functional demo see [RNSSampleLifecycleAwareView.m](https://github.com/kmagiera/react-native-screens/blob/master/Example/ios/ScreensExample/RNSSampleLifecycleAwareView.m) for more details.
|
|
146
146
|
|
|
147
147
|
### Navigation lifecycle on Android
|
|
148
148
|
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ buildscript {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:3.1
|
|
9
|
+
classpath 'com.android.tools.build:gradle:3.3.1'
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -18,8 +18,8 @@ def safeExtGet(prop, fallback) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
compileSdkVersion safeExtGet('compileSdkVersion',
|
|
22
|
-
buildToolsVersion safeExtGet('buildToolsVersion', '
|
|
21
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 28)
|
|
22
|
+
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
|
|
23
23
|
|
|
24
24
|
defaultConfig {
|
|
25
25
|
minSdkVersion safeExtGet('minSdkVersion', 16)
|
|
@@ -40,11 +40,14 @@ repositories {
|
|
|
40
40
|
url "$projectDir/../node_modules/react-native/android"
|
|
41
41
|
}
|
|
42
42
|
mavenCentral()
|
|
43
|
+
mavenLocal()
|
|
44
|
+
google()
|
|
45
|
+
jcenter()
|
|
46
|
+
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
dependencies {
|
|
46
50
|
implementation 'com.facebook.react:react-native:+'
|
|
47
|
-
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '26.+')}"
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
def configureReactNativePom(def pom) {
|
|
@@ -97,8 +100,8 @@ afterEvaluate { project ->
|
|
|
97
100
|
|
|
98
101
|
android.libraryVariants.all { variant ->
|
|
99
102
|
def name = variant.name.capitalize()
|
|
100
|
-
task "jar${name}"(type: Jar, dependsOn: variant.
|
|
101
|
-
from variant.
|
|
103
|
+
task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
|
|
104
|
+
from variant.javaCompileProvider.get().destinationDir
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
package com.swmansion.rnscreens;
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
3
|
+
import androidx.lifecycle.Lifecycle;
|
|
4
|
+
import androidx.lifecycle.LifecycleObserver;
|
|
5
|
+
import androidx.fragment.app.Fragment;
|
|
6
|
+
|
|
7
7
|
import android.view.View;
|
|
8
8
|
import android.view.ViewParent;
|
|
9
9
|
|
|
10
|
-
import com.facebook.react.modules.core.ChoreographerCompat;
|
|
11
|
-
import com.facebook.react.modules.core.ReactChoreographer;
|
|
12
|
-
|
|
13
|
-
import java.util.ArrayList;
|
|
14
10
|
import java.util.HashMap;
|
|
15
11
|
import java.util.Map;
|
|
16
12
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
package com.swmansion.rnscreens;
|
|
2
2
|
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import androidx.fragment.app.Fragment;
|
|
5
|
+
|
|
3
6
|
import android.annotation.SuppressLint;
|
|
4
7
|
import android.content.Context;
|
|
5
8
|
import android.graphics.Paint;
|
|
6
9
|
import android.os.Bundle;
|
|
7
|
-
import android.support.annotation.Nullable;
|
|
8
|
-
import android.support.v4.app.Fragment;
|
|
9
10
|
import android.view.LayoutInflater;
|
|
10
|
-
import android.view.MotionEvent;
|
|
11
11
|
import android.view.View;
|
|
12
12
|
import android.view.ViewGroup;
|
|
13
|
+
|
|
13
14
|
import com.facebook.react.uimanager.PointerEvents;
|
|
14
15
|
import com.facebook.react.uimanager.ReactPointerEventsView;
|
|
15
16
|
|
|
@@ -77,7 +78,7 @@ public class Screen extends ViewGroup implements ReactPointerEventsView {
|
|
|
77
78
|
|
|
78
79
|
@Override
|
|
79
80
|
public void setLayerType(int layerType, @Nullable Paint paint) {
|
|
80
|
-
// ignore
|
|
81
|
+
// ignore - layer type is controlled by `transitioning` prop
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
public void setNeedsOffscreenAlphaCompositing(boolean needsOffscreenAlphaCompositing) {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
package com.swmansion.rnscreens;
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import androidx.fragment.app.Fragment;
|
|
5
|
+
import androidx.fragment.app.FragmentActivity;
|
|
6
|
+
import androidx.fragment.app.FragmentTransaction;
|
|
7
|
+
|
|
4
8
|
import android.content.Context;
|
|
5
9
|
import android.content.ContextWrapper;
|
|
6
|
-
import android.support.annotation.Nullable;
|
|
7
|
-
import android.support.v4.app.Fragment;
|
|
8
|
-
import android.support.v4.app.FragmentActivity;
|
|
9
|
-
import android.support.v4.app.FragmentManager;
|
|
10
|
-
import android.support.v4.app.FragmentTransaction;
|
|
11
10
|
import android.view.ViewGroup;
|
|
12
11
|
import android.view.ViewParent;
|
|
13
12
|
|
|
14
13
|
import com.facebook.react.ReactRootView;
|
|
15
|
-
import com.facebook.react.bridge.ReactContext;
|
|
16
14
|
import com.facebook.react.modules.core.ChoreographerCompat;
|
|
17
15
|
import com.facebook.react.modules.core.ReactChoreographer;
|
|
18
16
|
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
10
|
448078F52114595900280661 /* RNSScreenContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 448078F12114595900280661 /* RNSScreenContainer.m */; };
|
|
11
11
|
448078F72114595900280661 /* RNSScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 448078F42114595900280661 /* RNSScreen.m */; };
|
|
12
|
+
B5C32A47220C6379000FFB8D /* RNSScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 448078F42114595900280661 /* RNSScreen.m */; };
|
|
13
|
+
B5C32A48220C6379000FFB8D /* RNSScreenContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 448078F12114595900280661 /* RNSScreenContainer.m */; };
|
|
12
14
|
/* End PBXBuildFile section */
|
|
13
15
|
|
|
14
16
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -21,6 +23,15 @@
|
|
|
21
23
|
);
|
|
22
24
|
runOnlyForDeploymentPostprocessing = 0;
|
|
23
25
|
};
|
|
26
|
+
B5C32A4A220C6379000FFB8D /* CopyFiles */ = {
|
|
27
|
+
isa = PBXCopyFilesBuildPhase;
|
|
28
|
+
buildActionMask = 2147483647;
|
|
29
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
30
|
+
dstSubfolderSpec = 16;
|
|
31
|
+
files = (
|
|
32
|
+
);
|
|
33
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
34
|
+
};
|
|
24
35
|
/* End PBXCopyFilesBuildPhase section */
|
|
25
36
|
|
|
26
37
|
/* Begin PBXFileReference section */
|
|
@@ -29,6 +40,7 @@
|
|
|
29
40
|
448078F02114595900280661 /* RNSScreenContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSScreenContainer.h; sourceTree = "<group>"; };
|
|
30
41
|
448078F12114595900280661 /* RNSScreenContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSScreenContainer.m; sourceTree = "<group>"; };
|
|
31
42
|
448078F42114595900280661 /* RNSScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSScreen.m; sourceTree = "<group>"; };
|
|
43
|
+
B5C32A4F220C6379000FFB8D /* libRNScreens-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRNScreens-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
32
44
|
/* End PBXFileReference section */
|
|
33
45
|
|
|
34
46
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -39,6 +51,13 @@
|
|
|
39
51
|
);
|
|
40
52
|
runOnlyForDeploymentPostprocessing = 0;
|
|
41
53
|
};
|
|
54
|
+
B5C32A49220C6379000FFB8D /* Frameworks */ = {
|
|
55
|
+
isa = PBXFrameworksBuildPhase;
|
|
56
|
+
buildActionMask = 2147483647;
|
|
57
|
+
files = (
|
|
58
|
+
);
|
|
59
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
60
|
+
};
|
|
42
61
|
/* End PBXFrameworksBuildPhase section */
|
|
43
62
|
|
|
44
63
|
/* Begin PBXGroup section */
|
|
@@ -58,6 +77,7 @@
|
|
|
58
77
|
448078F02114595900280661 /* RNSScreenContainer.h */,
|
|
59
78
|
448078F12114595900280661 /* RNSScreenContainer.m */,
|
|
60
79
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
80
|
+
B5C32A4F220C6379000FFB8D /* libRNScreens-tvOS.a */,
|
|
61
81
|
);
|
|
62
82
|
sourceTree = "<group>";
|
|
63
83
|
};
|
|
@@ -81,13 +101,30 @@
|
|
|
81
101
|
productReference = 134814201AA4EA6300B7C361 /* libRNScreens.a */;
|
|
82
102
|
productType = "com.apple.product-type.library.static";
|
|
83
103
|
};
|
|
104
|
+
B5C32A45220C6379000FFB8D /* RNScreens-tvOS */ = {
|
|
105
|
+
isa = PBXNativeTarget;
|
|
106
|
+
buildConfigurationList = B5C32A4B220C6379000FFB8D /* Build configuration list for PBXNativeTarget "RNScreens-tvOS" */;
|
|
107
|
+
buildPhases = (
|
|
108
|
+
B5C32A46220C6379000FFB8D /* Sources */,
|
|
109
|
+
B5C32A49220C6379000FFB8D /* Frameworks */,
|
|
110
|
+
B5C32A4A220C6379000FFB8D /* CopyFiles */,
|
|
111
|
+
);
|
|
112
|
+
buildRules = (
|
|
113
|
+
);
|
|
114
|
+
dependencies = (
|
|
115
|
+
);
|
|
116
|
+
name = "RNScreens-tvOS";
|
|
117
|
+
productName = RCTDataManager;
|
|
118
|
+
productReference = B5C32A4F220C6379000FFB8D /* libRNScreens-tvOS.a */;
|
|
119
|
+
productType = "com.apple.product-type.library.static";
|
|
120
|
+
};
|
|
84
121
|
/* End PBXNativeTarget section */
|
|
85
122
|
|
|
86
123
|
/* Begin PBXProject section */
|
|
87
124
|
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
88
125
|
isa = PBXProject;
|
|
89
126
|
attributes = {
|
|
90
|
-
LastUpgradeCheck =
|
|
127
|
+
LastUpgradeCheck = 920;
|
|
91
128
|
ORGANIZATIONNAME = Facebook;
|
|
92
129
|
TargetAttributes = {
|
|
93
130
|
58B511DA1A9E6C8500147676 = {
|
|
@@ -108,6 +145,7 @@
|
|
|
108
145
|
projectRoot = "";
|
|
109
146
|
targets = (
|
|
110
147
|
58B511DA1A9E6C8500147676 /* RNScreens */,
|
|
148
|
+
B5C32A45220C6379000FFB8D /* RNScreens-tvOS */,
|
|
111
149
|
);
|
|
112
150
|
};
|
|
113
151
|
/* End PBXProject section */
|
|
@@ -122,9 +160,34 @@
|
|
|
122
160
|
);
|
|
123
161
|
runOnlyForDeploymentPostprocessing = 0;
|
|
124
162
|
};
|
|
163
|
+
B5C32A46220C6379000FFB8D /* Sources */ = {
|
|
164
|
+
isa = PBXSourcesBuildPhase;
|
|
165
|
+
buildActionMask = 2147483647;
|
|
166
|
+
files = (
|
|
167
|
+
B5C32A47220C6379000FFB8D /* RNSScreen.m in Sources */,
|
|
168
|
+
B5C32A48220C6379000FFB8D /* RNSScreenContainer.m in Sources */,
|
|
169
|
+
);
|
|
170
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
171
|
+
};
|
|
125
172
|
/* End PBXSourcesBuildPhase section */
|
|
126
173
|
|
|
127
174
|
/* Begin XCBuildConfiguration section */
|
|
175
|
+
0CE596A6BAEE45CA860361AD /* Testflight */ = {
|
|
176
|
+
isa = XCBuildConfiguration;
|
|
177
|
+
buildSettings = {
|
|
178
|
+
HEADER_SEARCH_PATHS = (
|
|
179
|
+
"$(inherited)",
|
|
180
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
181
|
+
"$(SRCROOT)/../../../React/**",
|
|
182
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
183
|
+
);
|
|
184
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
185
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
186
|
+
PRODUCT_NAME = RNScreens;
|
|
187
|
+
SKIP_INSTALL = YES;
|
|
188
|
+
};
|
|
189
|
+
name = Testflight;
|
|
190
|
+
};
|
|
128
191
|
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
129
192
|
isa = XCBuildConfiguration;
|
|
130
193
|
buildSettings = {
|
|
@@ -250,6 +313,100 @@
|
|
|
250
313
|
};
|
|
251
314
|
name = Release;
|
|
252
315
|
};
|
|
316
|
+
B5C32A4C220C6379000FFB8D /* Debug */ = {
|
|
317
|
+
isa = XCBuildConfiguration;
|
|
318
|
+
buildSettings = {
|
|
319
|
+
HEADER_SEARCH_PATHS = (
|
|
320
|
+
"$(inherited)",
|
|
321
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
322
|
+
"$(SRCROOT)/../../../React/**",
|
|
323
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
324
|
+
);
|
|
325
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
326
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
327
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
328
|
+
SDKROOT = appletvos;
|
|
329
|
+
SKIP_INSTALL = YES;
|
|
330
|
+
};
|
|
331
|
+
name = Debug;
|
|
332
|
+
};
|
|
333
|
+
B5C32A4D220C6379000FFB8D /* Release */ = {
|
|
334
|
+
isa = XCBuildConfiguration;
|
|
335
|
+
buildSettings = {
|
|
336
|
+
HEADER_SEARCH_PATHS = (
|
|
337
|
+
"$(inherited)",
|
|
338
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
339
|
+
"$(SRCROOT)/../../../React/**",
|
|
340
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
341
|
+
);
|
|
342
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
343
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
344
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
345
|
+
SDKROOT = appletvos;
|
|
346
|
+
SKIP_INSTALL = YES;
|
|
347
|
+
};
|
|
348
|
+
name = Release;
|
|
349
|
+
};
|
|
350
|
+
B5C32A4E220C6379000FFB8D /* Testflight */ = {
|
|
351
|
+
isa = XCBuildConfiguration;
|
|
352
|
+
buildSettings = {
|
|
353
|
+
HEADER_SEARCH_PATHS = (
|
|
354
|
+
"$(inherited)",
|
|
355
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
356
|
+
"$(SRCROOT)/../../../React/**",
|
|
357
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
358
|
+
);
|
|
359
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
360
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
361
|
+
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
362
|
+
SDKROOT = appletvos;
|
|
363
|
+
SKIP_INSTALL = YES;
|
|
364
|
+
};
|
|
365
|
+
name = Testflight;
|
|
366
|
+
};
|
|
367
|
+
C7F03305A3464E75B4F5A6CE /* Testflight */ = {
|
|
368
|
+
isa = XCBuildConfiguration;
|
|
369
|
+
buildSettings = {
|
|
370
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
371
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
372
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
373
|
+
CLANG_ENABLE_MODULES = YES;
|
|
374
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
375
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
376
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
377
|
+
CLANG_WARN_COMMA = YES;
|
|
378
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
379
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
380
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
381
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
382
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
383
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
384
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
385
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
386
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
387
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
388
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
389
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
390
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
391
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
392
|
+
COPY_PHASE_STRIP = YES;
|
|
393
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
394
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
395
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
396
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
397
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
398
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
399
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
400
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
401
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
402
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
403
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
404
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
405
|
+
SDKROOT = iphoneos;
|
|
406
|
+
VALIDATE_PRODUCT = YES;
|
|
407
|
+
};
|
|
408
|
+
name = Testflight;
|
|
409
|
+
};
|
|
253
410
|
/* End XCBuildConfiguration section */
|
|
254
411
|
|
|
255
412
|
/* Begin XCConfigurationList section */
|
|
@@ -258,6 +415,7 @@
|
|
|
258
415
|
buildConfigurations = (
|
|
259
416
|
58B511ED1A9E6C8500147676 /* Debug */,
|
|
260
417
|
58B511EE1A9E6C8500147676 /* Release */,
|
|
418
|
+
C7F03305A3464E75B4F5A6CE /* Testflight */,
|
|
261
419
|
);
|
|
262
420
|
defaultConfigurationIsVisible = 0;
|
|
263
421
|
defaultConfigurationName = Release;
|
|
@@ -267,6 +425,17 @@
|
|
|
267
425
|
buildConfigurations = (
|
|
268
426
|
58B511F01A9E6C8500147676 /* Debug */,
|
|
269
427
|
58B511F11A9E6C8500147676 /* Release */,
|
|
428
|
+
0CE596A6BAEE45CA860361AD /* Testflight */,
|
|
429
|
+
);
|
|
430
|
+
defaultConfigurationIsVisible = 0;
|
|
431
|
+
defaultConfigurationName = Release;
|
|
432
|
+
};
|
|
433
|
+
B5C32A4B220C6379000FFB8D /* Build configuration list for PBXNativeTarget "RNScreens-tvOS" */ = {
|
|
434
|
+
isa = XCConfigurationList;
|
|
435
|
+
buildConfigurations = (
|
|
436
|
+
B5C32A4C220C6379000FFB8D /* Debug */,
|
|
437
|
+
B5C32A4D220C6379000FFB8D /* Release */,
|
|
438
|
+
B5C32A4E220C6379000FFB8D /* Testflight */,
|
|
270
439
|
);
|
|
271
440
|
defaultConfigurationIsVisible = 0;
|
|
272
441
|
defaultConfigurationName = Release;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screens",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
4
4
|
"description": "First incomplete navigation solution for your react-native app.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node node_modules/react-native/local-cli/cli.js start",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"url": "https://github.com/kmagiera/react-native-screens/issues"
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/kmagiera/react-native-screens#readme",
|
|
38
|
-
"dependencies": {
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"debounce": "^1.2.0"
|
|
40
|
+
},
|
|
39
41
|
"peerDependencies": {
|
|
40
42
|
"react": "*",
|
|
41
43
|
"react-native": "*"
|
package/src/screens.d.ts
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
declare module 'react-native-screens' {
|
|
5
5
|
import { ComponentClass } from 'react';
|
|
6
|
-
import { ViewProps } from 'react-native';
|
|
6
|
+
import { ViewProps, Animated } from 'react-native';
|
|
7
7
|
|
|
8
8
|
export function useScreens(shouldUseScreens?: boolean): void;
|
|
9
9
|
export function screensEnabled(): boolean;
|
|
10
10
|
|
|
11
11
|
export interface ScreenProps extends ViewProps {
|
|
12
|
-
active?:
|
|
12
|
+
active?: 0 | 1 | Animated.AnimatedInterpolation;
|
|
13
13
|
onComponentRef?: (view: any) => void;
|
|
14
14
|
}
|
|
15
15
|
export const Screen: ComponentClass<ScreenProps>;
|
package/src/screens.native.js
CHANGED
|
@@ -17,7 +17,7 @@ const getViewManagerConfigCompat = name =>
|
|
|
17
17
|
? UIManager.getViewManagerConfig(name)
|
|
18
18
|
: UIManager[name];
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function useScreens(shouldUseScreens = true) {
|
|
21
21
|
USE_SCREENS = shouldUseScreens;
|
|
22
22
|
if (USE_SCREENS && !getViewManagerConfigCompat('RNSScreen')) {
|
|
23
23
|
console.error(
|
|
@@ -26,20 +26,32 @@ export function useScreens(shouldUseScreens = true) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
function screensEnabled() {
|
|
30
30
|
return USE_SCREENS;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
// We initialize these lazily so that importing the module doesn't throw error when not linked
|
|
34
|
+
// This is necessary coz libraries such as React Navigation import the library where it may not be enabled
|
|
35
|
+
let NativeScreenValue;
|
|
36
|
+
let NativeScreenContainerValue;
|
|
37
|
+
let AnimatedNativeScreen;
|
|
34
38
|
|
|
35
|
-
const
|
|
39
|
+
const ScreensNativeModules = {
|
|
40
|
+
get NativeScreen() {
|
|
41
|
+
NativeScreenValue =
|
|
42
|
+
NativeScreenValue || requireNativeComponent('RNSScreen', null);
|
|
43
|
+
return NativeScreenValue;
|
|
44
|
+
},
|
|
36
45
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
46
|
+
get NativeScreenContainer() {
|
|
47
|
+
NativeScreenContainerValue =
|
|
48
|
+
NativeScreenContainerValue ||
|
|
49
|
+
requireNativeComponent('RNSScreenContainer', null);
|
|
50
|
+
return NativeScreenContainerValue;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
41
53
|
|
|
42
|
-
|
|
54
|
+
class Screen extends React.Component {
|
|
43
55
|
setNativeProps(props) {
|
|
44
56
|
this._ref.setNativeProps(props);
|
|
45
57
|
}
|
|
@@ -57,32 +69,52 @@ export class Screen extends React.Component {
|
|
|
57
69
|
const { active, onComponentRef, ...props } = this.props;
|
|
58
70
|
|
|
59
71
|
return <Animated.View {...props} ref={this.setRef} />;
|
|
60
|
-
} else if (version.minor >= 57) {
|
|
61
|
-
return <AnimatedNativeScreen {...this.props} />;
|
|
62
72
|
} else {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
AnimatedNativeScreen =
|
|
74
|
+
AnimatedNativeScreen ||
|
|
75
|
+
Animated.createAnimatedComponent(ScreensNativeModules.NativeScreen);
|
|
76
|
+
|
|
77
|
+
if (version.minor >= 57) {
|
|
78
|
+
return <AnimatedNativeScreen {...this.props} ref={this.setRef} />;
|
|
79
|
+
} else {
|
|
80
|
+
// On RN version below 0.57 we need to wrap screen's children with an
|
|
81
|
+
// additional View because of a bug fixed in react-native/pull/20658 which
|
|
82
|
+
// was preventing a view from having both styles and some other props being
|
|
83
|
+
// "animated" (using Animated native driver)
|
|
84
|
+
const { style, children, ...rest } = this.props;
|
|
85
|
+
return (
|
|
86
|
+
<AnimatedNativeScreen
|
|
87
|
+
{...rest}
|
|
88
|
+
ref={this.setRef}
|
|
89
|
+
style={StyleSheet.absoluteFill}>
|
|
90
|
+
<Animated.View style={style}>{children}</Animated.View>
|
|
91
|
+
</AnimatedNativeScreen>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
76
94
|
}
|
|
77
95
|
}
|
|
78
96
|
}
|
|
79
97
|
|
|
80
|
-
|
|
98
|
+
class ScreenContainer extends React.Component {
|
|
81
99
|
render() {
|
|
82
100
|
if (!USE_SCREENS) {
|
|
83
101
|
return <View {...this.props} />;
|
|
84
102
|
} else {
|
|
85
|
-
return <NativeScreenContainer {...this.props} />;
|
|
103
|
+
return <ScreensNativeModules.NativeScreenContainer {...this.props} />;
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
106
|
}
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
ScreenContainer,
|
|
110
|
+
Screen,
|
|
111
|
+
get NativeScreen() {
|
|
112
|
+
return ScreensNativeModules.NativeScreen;
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
get NativeScreenContainer() {
|
|
116
|
+
return ScreensNativeModules.NativeScreenContainer;
|
|
117
|
+
},
|
|
118
|
+
useScreens,
|
|
119
|
+
screensEnabled,
|
|
120
|
+
};
|
package/src/screens.web.js
CHANGED
|
@@ -1,16 +1,110 @@
|
|
|
1
|
+
import debounce from 'debounce';
|
|
2
|
+
import React from 'react';
|
|
1
3
|
import { Animated, View } from 'react-native';
|
|
2
4
|
|
|
5
|
+
let _shouldUseScreens = true;
|
|
6
|
+
|
|
3
7
|
export function useScreens(shouldUseScreens = true) {
|
|
4
8
|
if (shouldUseScreens) {
|
|
5
|
-
console.warn(
|
|
9
|
+
console.warn(
|
|
10
|
+
'react-native-screens is not fully supported on this platform yet.'
|
|
11
|
+
);
|
|
6
12
|
}
|
|
13
|
+
_shouldUseScreens = shouldUseScreens;
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
export function screensEnabled() {
|
|
10
|
-
return
|
|
17
|
+
return _shouldUseScreens;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isAnimatedValue(value) {
|
|
21
|
+
return value && value.__getValue && value.addListener;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isPropTruthy(prop) {
|
|
25
|
+
let activeValue = prop;
|
|
26
|
+
if (isAnimatedValue(prop)) {
|
|
27
|
+
activeValue = prop.__getValue();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return !!activeValue;
|
|
11
31
|
}
|
|
12
32
|
|
|
13
|
-
export
|
|
33
|
+
export class Screen extends React.Component {
|
|
34
|
+
static defaultProps = {
|
|
35
|
+
active: true,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
listenerId = null;
|
|
39
|
+
|
|
40
|
+
constructor(props) {
|
|
41
|
+
super(props);
|
|
42
|
+
|
|
43
|
+
this._onAnimatedValueUpdated = debounce(this._onAnimatedValueUpdated, 10);
|
|
44
|
+
this._addListener(props.active);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
componentWillUnmount() {
|
|
48
|
+
this._removeListener(this.props.active);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_addListener = possibleListener => {
|
|
52
|
+
if (this.listenerId)
|
|
53
|
+
throw new Error(
|
|
54
|
+
'Screen: Attempting to observe an animated value while another value is already observed.'
|
|
55
|
+
);
|
|
56
|
+
if (isAnimatedValue(possibleListener)) {
|
|
57
|
+
this.listenerId = possibleListener.addListener(
|
|
58
|
+
this._onAnimatedValueUpdated
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_removeListener = possibleListener => {
|
|
64
|
+
if (isAnimatedValue(possibleListener)) {
|
|
65
|
+
possibleListener.removeListener(this.listenerId);
|
|
66
|
+
this.listenerId = null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
shouldComponentUpdate({ active: nextActive }) {
|
|
71
|
+
const { active } = this.props;
|
|
72
|
+
if (nextActive !== active) {
|
|
73
|
+
this._removeListener(active);
|
|
74
|
+
this._addListener(nextActive);
|
|
75
|
+
this._updateDisplay(isPropTruthy(nextActive));
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_onAnimatedValueUpdated = ({ value }) => {
|
|
82
|
+
this._updateDisplay(!!value);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
_updateDisplay = isActive => {
|
|
86
|
+
if (isActive === undefined) {
|
|
87
|
+
isActive = isPropTruthy(this.props.active);
|
|
88
|
+
}
|
|
89
|
+
const display = isActive ? 'flex' : 'none';
|
|
90
|
+
this.setNativeProps({ style: { display } });
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
setNativeProps = nativeProps => {
|
|
94
|
+
if (this._view) {
|
|
95
|
+
this._view.setNativeProps(nativeProps);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
_setRef = view => {
|
|
100
|
+
this._view = view;
|
|
101
|
+
this._updateDisplay();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
render() {
|
|
105
|
+
return <Animated.View {...this.props} ref={this._setRef} />;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
14
108
|
|
|
15
109
|
export const ScreenContainer = View;
|
|
16
110
|
|
|
Binary file
|
package/ios/RNScreens.xcodeproj/xcuserdata/mdk.xcuserdatad/xcschemes/xcschememanagement.plist
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>RNReanimated.xcscheme</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>0</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
<key>RNSScreen.xcscheme</key>
|
|
13
|
-
<dict>
|
|
14
|
-
<key>orderHint</key>
|
|
15
|
-
<integer>0</integer>
|
|
16
|
-
</dict>
|
|
17
|
-
<key>RNScreens.xcscheme</key>
|
|
18
|
-
<dict>
|
|
19
|
-
<key>orderHint</key>
|
|
20
|
-
<integer>37</integer>
|
|
21
|
-
</dict>
|
|
22
|
-
<key>RNScreens.xcscheme_^#shared#^_</key>
|
|
23
|
-
<dict>
|
|
24
|
-
<key>orderHint</key>
|
|
25
|
-
<integer>37</integer>
|
|
26
|
-
</dict>
|
|
27
|
-
</dict>
|
|
28
|
-
</dict>
|
|
29
|
-
</plist>
|