byteburgers / react-native-autocomplete-input

Pure javascript autocomplete input for react-native
https://byteburgers.com/autocomplete
MIT License
818 stars 255 forks source link

component is completely frozen #209

Closed 1guzzy closed 3 years ago

1guzzy commented 3 years ago

The component is completely frozen. I'm hoping I'm just doing something wrong. I checked to make sure onChangeText was executing and the playerTwo state variable was being updated.

Screenshot

Screen Shot 2021-07-21 at 12 09 18 AM

Screen with auto complete component.

const NewChallengeScreen = ({navigation}) => {
  const [playerTwo, setPlayerTwo] = useState('');
  const users = [
    {user: 'someone', key: 1},
    {user: 'mrguytown', key: 2},
    {user: 'frankie123', key: 3},
  ];
  return (
    <SafeAreaView style={styles.container}>
      <Text style={styles.bigText}>Challenge a Friend</Text>
      <Autocomplete
        data={users}
        value={playerTwo}
        onChangeText={t => {
          setPlayerTwo(t);
        }}
        flatListProps={{
          keyExtractor: i => i.key,
          renderItem: ({item}) => <Text>{item.user}</Text>,
        }}
      />
      <TouchableOpacity style={styles.button}>
        <Text style={styles.buttonText}>Submit Challenge</Text>
      </TouchableOpacity>
    </SafeAreaView>
  );
};

package.json

{
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-firebase/app": "^12.2.0",
    "@react-native-firebase/database": "^12.2.0",
    "@react-native-firebase/functions": "^12.2.0",
    "@react-navigation/bottom-tabs": "^5.11.11",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.5",
    "react": "17.0.1",
    "react-native": "0.64.2",
    "react-native-autocomplete-input": "^5.0.2",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-health": "^1.9.0",
    "react-native-reanimated": "^2.2.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^3.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "17.0.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
1guzzy commented 3 years ago

Any suggestions would be greatly appreciated, I'm in a hackathon that is due this weekend!

iskeld commented 3 months ago

@1guzzy did you manage to fix it somehow?