Skip to content

Commit

Permalink
style: 💄 Improve all popup modal
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Nov 5, 2023
1 parent a110f65 commit fc1f838
Show file tree
Hide file tree
Showing 14 changed files with 434 additions and 271 deletions.
35 changes: 22 additions & 13 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import messaging, {
FirebaseMessagingTypes,
} from '@react-native-firebase/messaging';
import {handlePushNotification} from './src/utils/pushNotifications';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';

const Stack = createNativeStackNavigator<RootStackParamList>();

Expand Down Expand Up @@ -157,19 +159,26 @@ function App(): JSX.Element {
}, []);

return (
<StoreProvider>
<NavigationContainer ref={navigationRef}>
<Stack.Navigator
initialRouteName="Splash"
screenOptions={{headerShown: false}}>
<Stack.Screen name="Splash" component={SplashScreen} />
<Stack.Screen name="Login" component={LoginView} />
<Stack.Screen name="Main" component={LoggedInView} />
<Stack.Screen name="Message" component={MessagesView} />
<Stack.Screen name="ChannelDetails" component={ChannelDetailsView} />
</Stack.Navigator>
</NavigationContainer>
</StoreProvider>
<GestureHandlerRootView style={{flex: 1}}>
<StoreProvider>
<NavigationContainer ref={navigationRef}>
<BottomSheetModalProvider>
<Stack.Navigator
initialRouteName="Splash"
screenOptions={{headerShown: false}}>
<Stack.Screen name="Splash" component={SplashScreen} />
<Stack.Screen name="Login" component={LoginView} />
<Stack.Screen name="Main" component={LoggedInView} />
<Stack.Screen name="Message" component={MessagesView} />
<Stack.Screen
name="ChannelDetails"
component={ChannelDetailsView}
/>
</Stack.Navigator>
</BottomSheetModalProvider>
</NavigationContainer>
</StoreProvider>
</GestureHandlerRootView>
);
}

Expand Down
5 changes: 4 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['module:react-native-dotenv'],
plugins: [
'module:react-native-dotenv',
'react-native-reanimated/plugin', // must be last
],
};
135 changes: 130 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"windows": "react-native run-windows"
},
"dependencies": {
"@gorhom/bottom-sheet": "^4.5.1",
"@nerimity/nevula": "^0.12.3",
"@notifee/react-native": "^7.8.0",
"@react-native-clipboard/clipboard": "^1.11.2",
Expand All @@ -27,7 +28,9 @@
"react-native": "0.71.8",
"react-native-encrypted-storage": "^4.0.3",
"react-native-fast-image": "^8.6.3",
"react-native-gesture-handler": "^2.13.4",
"react-native-image-picker": "^5.6.0",
"react-native-reanimated": "^3.5.4",
"react-native-safe-area-context": "^4.5.3",
"react-native-screens": "^3.20.0",
"react-native-vector-icons": "^9.2.0",
Expand Down
31 changes: 12 additions & 19 deletions src/components/ChannelDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import {ServerRole} from '../store/serverRoles';
import Avatar from './ui/Avatar';
import {observer} from 'mobx-react-lite';
import {ProfileContextMenu} from './context-menu/ProfileContextMenu';
import {CustomPortalProvider, useCustomPortal} from '../utils/CustomPortal';
import {Pressable} from 'react-native-windows';
import CustomPressable from './ui/CustomPressable';
import {ModalRef} from './ui/Modal';

export type ChannelDetailsScreenRouteProp = RouteProp<
RootStackParamList,
Expand All @@ -25,12 +24,10 @@ export type ChannelDetailsScreenNavigationProp =

export default function ChannelDetailsView() {
return (
<CustomPortalProvider>
<View style={styles.pageContainer}>
<PageHeader />
<ServerMemberList />
</View>
</CustomPortalProvider>
<View style={styles.pageContainer}>
<PageHeader />
<ServerMemberList />
</View>
);
}

Expand Down Expand Up @@ -98,19 +95,10 @@ const RoleItem = (props: {
);
};
const MemberItem = (props: {member: ServerMember; role: ServerRole}) => {
const {createPortal} = useCustomPortal();
const profileContextMenuRef = React.useRef<ModalRef>(null);

const onPress = () => {
createPortal(
close => (
<ProfileContextMenu
user={props.member.user}
userId={props.member.userId}
close={close}
/>
),
'profile-modal',
);
profileContextMenuRef.current?.modal.present();
};

return (
Expand All @@ -123,6 +111,11 @@ const MemberItem = (props: {member: ServerMember; role: ServerRole}) => {
{props.member.user.username}
</Text>
</View>
<ProfileContextMenu
ref={profileContextMenuRef}
user={props.member.user}
userId={props.member.userId}
/>
</CustomPressable>
);
};
Expand Down
Loading

0 comments on commit fc1f838

Please sign in to comment.