Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

iOS scroll issue #48

Closed
stephan-J opened this issue Feb 13, 2019 · 5 comments
Closed

iOS scroll issue #48

stephan-J opened this issue Feb 13, 2019 · 5 comments

Comments

@stephan-J
Copy link

Hi @baijunjie ,

I have an same issue about previous issue #43 (comment)
When I using this module together with the screen transition module (react-navigation-transitions) .

Error Code is below.
After transition FirstScreen to MainScreen fromBottom, MainScreen has a problem.

  • App.js
import { createAppContainer, createStackNavigator } from 'react-navigation';
import { fromBottom } from 'react-navigation-transitions';

import FirstScreen from './First';  //Temp first screen component
import MainScreen from './Main';  //example code for react-native-input-scroll-view component

const RootStack = createStackNavigator({
  First: FirstScreen,
  Main: MainScreen,
}, {
  navigationOptions: {
    header: null,
    gesturesEnabled: false,
  },
  initialRouteName: 'First',
  transitionConfig: () => fromBottom()
});


export default App = createAppContainer(RootStack);
  • First.js
import React, {Component} from 'react';
import { View, Text, TouchableOpacity} from 'react-native';

export default class First extends Component {
    render() {
        return (
            <View>
                <TouchableOpacity
                onPress={()=>this.props.navigation.navigate('Main')}>
                    <Text>Touch to Main</Text>    
                </TouchableOpacity>
                
            </View>
        )
    }
}
  • Main.js
export default class MainScreen extends Component<Props> {
  state = {
    text: '',
    textarea: '',
  };

  render() {
    const { text, textarea } = this.state;
    return (
      <View style={styles.container}>
        <InputScrollView>
          <View style={styles.placeholder} />
          <TextInput style={styles.input} value={text} />
          <TextInput style={styles.textarea}
                     value={textarea}
                     onChangeText={text => this.setState({ textarea: text })}
                     multiline />
        </InputScrollView>
      </View>
    );
  }
}
@baijunjie
Copy link
Owner

Hi, I'm not sure what went wrong, I need more detailed error information.

@stephan-J
Copy link
Author

stephan-J commented Feb 13, 2019

I'm used 2 RN module, react-native-input-scroll-view and react-navigation-transitions.

  1. I had screen transition from 'FirstScreen' to 'MainScreen' via react-navigation-transitions (use fromBottom function)
  2. In MainScreen(is same your example code) touch textinput
  3. Same error with iOS scroll issue #43 (comment)

It's occur only fromBottom function not fromLeft, fromRight etc.

I think that error is about conflict to react-native-input-scroll-view and react-navigation-transitions.

@baijunjie
Copy link
Owner

@stephan-J HI, This issue should have something to do with scrollResponderScrollNativeHandleToKeyboard() compatibility, can you reproduce it in https://snack.expo.io/
Thanks.

@stephan-J
Copy link
Author

stephan-J commented Feb 14, 2019

Hi @baijunjie , You can see in
https://snack.expo.io/@jsc/simple-project

If you touch 'Touch to main' then check your example screen.

@baijunjie
Copy link
Owner

baijunjie commented Feb 16, 2019

Thank you for your help.
I found the problem. The problem is that the screen enters the screen dynamically, and the automatic topOffset is wrong in the initial stage. Now try v1.9.0 and set the topOffset props manually.

Suppose TopBar.height=60

<InputScrollView topOffset={TopBar.height}>
         ...
</InputScrollView>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants