react-native-bootsplash 5.5.2 → 6.0.0-beta.0
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 +38 -38
- package/app.plugin.js +2 -0
- package/dist/commonjs/addon/index.js +38 -30
- package/dist/commonjs/addon/index.js.map +1 -1
- package/dist/commonjs/generate.js +570 -203
- package/dist/commonjs/generate.js.map +1 -1
- package/dist/commonjs/index.js +19 -13
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/addon/index.js +38 -30
- package/dist/module/addon/index.js.map +1 -1
- package/dist/module/generate.js +559 -190
- package/dist/module/generate.js.map +1 -1
- package/dist/module/index.js +19 -13
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/addon/index.d.ts +1 -1
- package/dist/typescript/addon/index.d.ts.map +1 -1
- package/dist/typescript/generate.d.ts +47 -41
- package/dist/typescript/generate.d.ts.map +1 -1
- package/dist/typescript/index.d.ts +1 -0
- package/dist/typescript/index.d.ts.map +1 -1
- package/package.json +16 -12
- package/react-native.config.js +16 -10
- package/src/generate.ts +779 -279
- package/src/index.ts +26 -16
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export type Manifest = {
|
|
|
29
29
|
|
|
30
30
|
export type UseHideAnimationConfig = {
|
|
31
31
|
manifest: Manifest;
|
|
32
|
+
ready?: boolean;
|
|
32
33
|
|
|
33
34
|
logo?: ImageRequireSource;
|
|
34
35
|
darkLogo?: ImageRequireSource;
|
|
@@ -59,6 +60,7 @@ export function isVisible(): Promise<boolean> {
|
|
|
59
60
|
export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
60
61
|
const {
|
|
61
62
|
manifest,
|
|
63
|
+
ready = true,
|
|
62
64
|
|
|
63
65
|
logo: logoSrc,
|
|
64
66
|
darkLogo: darkLogoSrc,
|
|
@@ -106,31 +108,39 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
106
108
|
? darkBrandSrc
|
|
107
109
|
: brandSrc;
|
|
108
110
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const ref = useRef({
|
|
112
|
+
layoutReady: false,
|
|
113
|
+
logoReady: skipLogo,
|
|
114
|
+
brandReady: skipBrand,
|
|
115
|
+
userReady: ready,
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
animate,
|
|
118
|
+
animateHasBeenCalled: false,
|
|
117
119
|
});
|
|
118
120
|
|
|
119
121
|
const maybeRunAnimate = useCallback(() => {
|
|
120
122
|
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
ref.current.layoutReady &&
|
|
124
|
+
ref.current.logoReady &&
|
|
125
|
+
ref.current.brandReady &&
|
|
126
|
+
ref.current.userReady &&
|
|
127
|
+
!ref.current.animateHasBeenCalled
|
|
125
128
|
) {
|
|
126
|
-
|
|
129
|
+
ref.current.animateHasBeenCalled = true;
|
|
127
130
|
|
|
128
131
|
hide({ fade: false })
|
|
129
|
-
.then(() =>
|
|
132
|
+
.then(() => ref.current.animate())
|
|
130
133
|
.catch(() => {});
|
|
131
134
|
}
|
|
132
135
|
}, []);
|
|
133
136
|
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
ref.current.animate = animate;
|
|
139
|
+
ref.current.userReady = ready;
|
|
140
|
+
|
|
141
|
+
maybeRunAnimate();
|
|
142
|
+
});
|
|
143
|
+
|
|
134
144
|
return useMemo<UseHideAnimation>(() => {
|
|
135
145
|
const containerStyle: ViewStyle = {
|
|
136
146
|
...StyleSheet.absoluteFillObject,
|
|
@@ -142,7 +152,7 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
142
152
|
const container: ViewProps = {
|
|
143
153
|
style: containerStyle,
|
|
144
154
|
onLayout: () => {
|
|
145
|
-
|
|
155
|
+
ref.current.layoutReady = true;
|
|
146
156
|
maybeRunAnimate();
|
|
147
157
|
},
|
|
148
158
|
};
|
|
@@ -159,7 +169,7 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
159
169
|
height: logoHeight,
|
|
160
170
|
},
|
|
161
171
|
onLoadEnd: () => {
|
|
162
|
-
|
|
172
|
+
ref.current.logoReady = true;
|
|
163
173
|
maybeRunAnimate();
|
|
164
174
|
},
|
|
165
175
|
};
|
|
@@ -178,7 +188,7 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
178
188
|
height: brandHeight,
|
|
179
189
|
},
|
|
180
190
|
onLoadEnd: () => {
|
|
181
|
-
|
|
191
|
+
ref.current.brandReady = true;
|
|
182
192
|
maybeRunAnimate();
|
|
183
193
|
},
|
|
184
194
|
};
|