mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
FIX: View pager ref fix
This commit is contained in:
parent
9956118f83
commit
9200218569
1 changed files with 6 additions and 4 deletions
|
@ -41,6 +41,7 @@ export default class WalletsList extends Component {
|
|||
lastSnappedTo: 0,
|
||||
timeElpased: 0,
|
||||
cameraPreviewIsPaused: true,
|
||||
viewPagerIndex: 1,
|
||||
};
|
||||
EV(EV.enum.WALLETS_COUNT_CHANGED, () => this.redrawScreen(true));
|
||||
|
||||
|
@ -296,12 +297,13 @@ export default class WalletsList extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
onViewPagerScroll = (e: PageSelectedEvent) => {
|
||||
onPageSelected = (e: PageSelectedEvent) => {
|
||||
const index = e.nativeEvent.position
|
||||
StatusBar.setBarStyle(index === 1 ? 'dark-content' : 'light-content');
|
||||
this.setState({ cameraPreviewIsPaused: index === 1 || index === undefined });
|
||||
this.setState({ cameraPreviewIsPaused: index === 1 || index === undefined, viewPagerIndex: index });
|
||||
};
|
||||
|
||||
|
||||
onBarScanned = value => {
|
||||
DeeplinkSchemaMatch.navigationRouteFor({ url: value }, completionValue => {
|
||||
ReactNativeHapticFeedback.trigger('impactLight', { ignoreAndroidSystemSettings: false });
|
||||
|
@ -336,14 +338,14 @@ export default class WalletsList extends Component {
|
|||
<NavigationEvents
|
||||
onDidFocus={() => {
|
||||
this.redrawScreen();
|
||||
this.setState({ cameraPreviewIsPaused: this.viewPageRef.current.index === 1 || this.viewPageRef.current.index === undefined });
|
||||
this.setState({ cameraPreviewIsPaused: this.state.viewPagerIndex === 1 });
|
||||
}}
|
||||
onWillBlur={() => this.setState({ cameraPreviewIsPaused: true })}
|
||||
/>
|
||||
<ScrollView contentContainerStyle={{ flex: 1 }}>
|
||||
<ViewPager
|
||||
style={styles.wrapper}
|
||||
onPageScroll={this.onViewPagerScroll}
|
||||
onPageSelected={this.onPageSelected}
|
||||
initialPage={1}
|
||||
ref={this.viewPagerRef}
|
||||
showPageIndicator={false}
|
||||
|
|
Loading…
Add table
Reference in a new issue