Commit 87e84ba1 by Giang Tran

update code

parent 8397333d
...@@ -19,9 +19,36 @@ let store = createStore(rootReducer, applyMiddleware(sagaMiddleware)); ...@@ -19,9 +19,36 @@ let store = createStore(rootReducer, applyMiddleware(sagaMiddleware));
sagaMiddleware.run(rootSaga); sagaMiddleware.run(rootSaga);
let App = () => { let App = () => {
let [bootSplashIsVisible, setBootSplashIsVisible] = useState(true);
let [bootSplashLogoIsLoaded, setBootSplashLogoIsLoaded] = useState(false);
let opacity = useRef(new Animated.Value(1));
let translateY = useRef(new Animated.Value(0));
let init = async () => { let init = async () => {
// You can uncomment this line to add a delay on app startup
await fakeApiCallWithoutBadNetwork(1000); await fakeApiCallWithoutBadNetwork(1000);
await BootSplash.hide(); await BootSplash.hide();
Animated.stagger(250, [
Animated.spring(translateY.current, {
useNativeDriver: true,
toValue: -50,
}),
Animated.spring(translateY.current, {
useNativeDriver: true,
toValue: Dimensions.get('window').height,
}),
]).start();
Animated.timing(opacity.current, {
useNativeDriver: true,
toValue: 0,
duration: 150,
delay: 350,
}).start(() => {
setBootSplashIsVisible(false);
});
}; };
useEffect(() => { useEffect(() => {
...@@ -33,6 +60,25 @@ let App = () => { ...@@ -33,6 +60,25 @@ let App = () => {
<Provider store={store}> <Provider store={store}>
<RootView /> <RootView />
</Provider> </Provider>
{bootSplashIsVisible && (
<Animated.View
style={[
StyleSheet.absoluteFill,
styles.bootsplash,
{opacity: opacity.current},
]}>
<Animated.Image
source={bootSplashLogo}
fadeDuration={0}
onLoadEnd={() => setBootSplashLogoIsLoaded(true)}
style={[
styles.logo,
{transform: [{translateY: translateY.current}]},
]}
/>
</Animated.View>
)}
</View> </View>
); );
}; };
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="BootSplashLogo" translatesAutoresizingMaskIntoConstraints="NO" id="3lX-Ut-9ad"> <imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="BootSplashLogo" translatesAutoresizingMaskIntoConstraints="NO" id="3lX-Ut-9ad">
<rect key="frame" x="127.5" y="313" width="120" height="41"/> <rect key="frame" x="77.5" y="296.5" width="220" height="74"/>
<accessibility key="accessibilityConfiguration"> <accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/> <accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
</accessibility> </accessibility>
...@@ -40,6 +40,6 @@ ...@@ -40,6 +40,6 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="BootSplashLogo" width="120" height="41"/> <image name="BootSplashLogo" width="220" height="74"/>
</resources> </resources>
</document> </document>
...@@ -68,7 +68,7 @@ const Success = (props) => { ...@@ -68,7 +68,7 @@ const Success = (props) => {
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<FlatList <FlatList
keyExtractor={(item) => item.transection_id} keyExtractor={(item) => item.transection_id + 'a'}
refreshing={isRefresh} refreshing={isRefresh}
onRefresh={onRefresh} onRefresh={onRefresh}
onEndReachedThreshold={0.01} onEndReachedThreshold={0.01}
......
...@@ -68,7 +68,7 @@ const Watting = (props) => { ...@@ -68,7 +68,7 @@ const Watting = (props) => {
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<FlatList <FlatList
keyExtractor={(item) => item.transection_id} keyExtractor={(item) => item.transection_id + 'a'}
refreshing={isRefresh} refreshing={isRefresh}
onRefresh={onRefresh} onRefresh={onRefresh}
onEndReachedThreshold={0.01} onEndReachedThreshold={0.01}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment