Skip to content

Commit 8a18757

Browse files
committed
Fix native picker not launching on android
1 parent d286702 commit 8a18757

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/core/src/components/Picker/NativePicker.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import PickerInputContainer from "./PickerInputContainer";
1414
import { withTheme } from "@draftbit/theme";
1515

1616
const isIos = Platform.OS === "ios";
17+
const isAndroid = Platform.OS === "android";
1718
const isWeb = Platform.OS === "web";
1819

1920
const NativePicker: React.FC<CommonPickerProps & SinglePickerProps> = ({
@@ -121,7 +122,8 @@ const NativePicker: React.FC<CommonPickerProps & SinglePickerProps> = ({
121122
{...rest}
122123
>
123124
{/* Web version is collapsed by default, always show to allow direct expand */}
124-
{(pickerVisible || isWeb) && !disabled && renderPicker()}
125+
{/* Android version needs to always be visible to allow .focus() call to launch the dialog */}
126+
{(pickerVisible || isAndroid || isWeb) && !disabled && renderPicker()}
125127
</PickerInputContainer>
126128
);
127129
};
@@ -141,6 +143,9 @@ const styles = StyleSheet.create({
141143
web: {
142144
height: "100%", //To have the <select/> element fill the height
143145
},
146+
android: {
147+
opacity: 0, // picker is a dialog, we don't want to show the default 'picker button' component
148+
},
144149
}),
145150
},
146151
iosNativePicker: {

0 commit comments

Comments
 (0)