Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed Jan 16, 2025
1 parent bed276e commit 0af03c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/components/setting/SelectDialogWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';
import { View, ViewStyle } from 'react-native';
import { View } from 'react-native';

import GenericSelectDialog from '../dialogs/GenericSelectDialog';
import { SelectSettingEntry } from './helpers/SettingEntry';
import { styles } from '@components/style';

export interface SelectDialogChildren<T> {
setCurrentSelectOption: React.Dispatch<
Expand All @@ -12,16 +13,15 @@ export interface SelectDialogChildren<T> {
}

interface Props<T> {
viewStyle?: ViewStyle;
Children: (p: SelectDialogChildren<T>) => React.JSX.Element;
}
export default function SelectDialog<T>({ Children, viewStyle }: Props<T>) {
export default function SelectDialog<T>({ Children }: Props<T>) {
const [currentSelectOption, setCurrentSelectOption] =
React.useState<SelectSettingEntry<T>>();
const [selectVisible, setSelectVisible] = React.useState(false);

return (
<View style={viewStyle}>
<View style={styles.flex}>
<Children
setCurrentSelectOption={setCurrentSelectOption}
setSelectVisible={setSelectVisible}
Expand Down
10 changes: 6 additions & 4 deletions src/components/setting/developer/View.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { View } from 'react-native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import PluginSettings from './plugins/View';
Expand All @@ -13,13 +14,14 @@ const Stack = createNativeStackNavigator();
const HomeWrapper = ({ navigation }: NoxComponent.StackNavigationProps) => {
const playerStyle = useNoxSetting(state => state.playerStyle);
return (
<SelectDialogWrapper
viewStyle={{
<View
style={{
backgroundColor: playerStyle.customColors.maskedBackgroundColor,
flex: 1,
}}
Children={p => Home({ ...p, navigation })}
/>
>
<SelectDialogWrapper Children={p => Home({ ...p, navigation })} />
</View>
);
};

Expand Down

0 comments on commit 0af03c8

Please sign in to comment.