picker
picker copied to clipboard
Picker style not working in Android
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @react-native-picker/[email protected] for the project I'm working on.
The style props does not work.***
Expected behaviour:
Set
itemStyleStyle to apply to each of the item labels.
Actually behaviour:
The
fontSizeandfontFamilydo not have impacts
- Platform: android
- Version: "2.4.8"
Here is the diff that solved my problem, partially and specific to this project:
diff --git a/node_modules/@react-native-picker/picker/js/PickerAndroid.android.js b/node_modules/@react-native-picker/picker/js/PickerAndroid.android.js
index 6ab670b..0e30750 100644
--- a/node_modules/@react-native-picker/picker/js/PickerAndroid.android.js
+++ b/node_modules/@react-native-picker/picker/js/PickerAndroid.android.js
@@ -23,6 +23,7 @@ import AndroidDropdownPickerNativeComponent from './AndroidDropdownPickerNativeC
const MODE_DROPDOWN = 'dropdown';
import type {TextStyleProp} from 'StyleSheet';
+import { defaultFontSize } from '../../../../style/global';
type PickerAndroidProps = $ReadOnly<{|
children?: React.Node,
@@ -103,11 +104,12 @@ function PickerAndroid(props: PickerAndroidProps, ref: PickerRef): React.Node {
label,
enabled,
style: {
- ...style,
color: style.color ? processColor(style.color) : null,
backgroundColor: style.backgroundColor
? processColor(style.backgroundColor)
: null,
+ fontSize: defaultFontSize, // Resolves to a number
+ ...style,
},
};
});
This issue body was partially generated by patch-package.