Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't see numbers inputted #235

Open
Viktor-as opened this issue Jan 29, 2024 · 0 comments
Open

Don't see numbers inputted #235

Viktor-as opened this issue Jan 29, 2024 · 0 comments

Comments

@Viktor-as
Copy link

Viktor-as commented Jan 29, 2024

Hey,

basically I was having the same problem as in this issue.

On most of the phones that I tested everything was ok, but on some (like Huawei pro 20 (Android 10)) the numbers that you input were not shown.

Accidently discovered that if you specify the colors for cursor (like here) and for input - then everything is ok, and I started seeing my input also on Huawei Pro 20.

Maybe this could be fixed or added to the documentation. Hope this helps.

                       <CodeField
                          ref={ref}
                          {...props}
                          value={value}
                          onChangeText={val => {
                            setFieldValue('code', val);
                            setValue(val);
                          }}
                          cellCount={CELL_COUNT}
                          rootStyle={styles.codeFieldRoot}
                          keyboardType="number-pad"
                          textContentType="oneTimeCode"
                          renderCell={({index, symbol, isFocused}) => (
                            <Text
                              key={index}
                              style={[
                                styles.cell,
                                isFocused && styles.focusCell,
                              ]}
                              onLayout={getCellOnLayoutHandler(index)}>
                              {symbol ||
                                (isFocused ? (
                                  <Text style={{color: '#000'}}> // ← this line -------------------------
                                    <Cursor />
                                  </Text>
                                ) : null)}
                            </Text>
                          )}
                        />
const styles = StyleSheet.create({
  root: {flex: 1, paddingLeft: vwNumber(60), paddingRight: vwNumber(60)},
  codeFieldRoot: {marginTop: 30, paddingBottom: 30},
  cell: {
    width: 30,
    height: 30,
    lineHeight: 20,
    fontSize: 17,
    borderWidth: 1,
    backgroundColor: 'white',
    borderColor: '#000',
    textAlign: 'center',
    color: '#000', // ← this line ----------------------
    paddingTop: 5,
  },
  focusCell: {
    borderColor: '#000',
  },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant