show bug with mobx
This commit is contained in:
+8
-11
@@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
import {observer} from 'mobx-react-lite'
|
||||||
import Animated, {useAnimatedScrollHandler} from 'react-native-reanimated'
|
import Animated, {useAnimatedScrollHandler} from 'react-native-reanimated'
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
@@ -9,13 +10,16 @@ export default function App() {
|
|||||||
return () => clearInterval(id)
|
return () => clearInterval(id)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// props to pass into children render functions
|
const handler = useAnimatedScrollHandler({
|
||||||
const onScroll = useAnimatedScrollHandler({
|
onScroll() {
|
||||||
onScroll(e) {
|
|
||||||
console.log(x)
|
console.log(x)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return <Child onScroll={handler} />
|
||||||
|
}
|
||||||
|
|
||||||
|
const Child = observer(function ({onScroll}) {
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1, flexDirection: 'row'}}>
|
<View style={{flex: 1, flexDirection: 'row'}}>
|
||||||
<Animated.FlatList
|
<Animated.FlatList
|
||||||
@@ -25,13 +29,6 @@ export default function App() {
|
|||||||
paddingTop: 1000,
|
paddingTop: 1000,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Animated.FlatList
|
|
||||||
onScroll={onScroll}
|
|
||||||
style={{flex: 1, backgroundColor: 'blue'}}
|
|
||||||
contentContainerStyle={{
|
|
||||||
paddingTop: 1000,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user