InsideStack compiling
This commit is contained in:
parent
3def144e64
commit
0cc510d818
|
@ -3,7 +3,7 @@ import hoistNonReactStatics from 'hoist-non-react-statics';
|
||||||
|
|
||||||
import { isTablet } from './utils/deviceInfo';
|
import { isTablet } from './utils/deviceInfo';
|
||||||
|
|
||||||
export const SplitContext = React.createContext(null);
|
export const SplitContext = React.createContext({ split: false });
|
||||||
|
|
||||||
export function withSplit(Component) {
|
export function withSplit(Component) {
|
||||||
if (isTablet) {
|
if (isTablet) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ const ChatsStack = () => {
|
||||||
component={RoomsListView}
|
component={RoomsListView}
|
||||||
options={RoomsListView.navigationOptions}
|
options={RoomsListView.navigationOptions}
|
||||||
/>
|
/>
|
||||||
<Chats.Screen
|
{/* <Chats.Screen
|
||||||
name='RoomActionsView'
|
name='RoomActionsView'
|
||||||
component={RoomActionsView}
|
component={RoomActionsView}
|
||||||
options={RoomActionsView.navigationOptions}
|
options={RoomActionsView.navigationOptions}
|
||||||
|
@ -142,7 +142,7 @@ const ChatsStack = () => {
|
||||||
name='ReadReceiptsView'
|
name='ReadReceiptsView'
|
||||||
component={ReadReceiptsView}
|
component={ReadReceiptsView}
|
||||||
options={ReadReceiptsView.navigationOptions}
|
options={ReadReceiptsView.navigationOptions}
|
||||||
/>
|
/> */}
|
||||||
</Chats.Navigator>
|
</Chats.Navigator>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,51 +101,6 @@ const getItemLayout = (data, index) => ({
|
||||||
const keyExtractor = item => item.rid;
|
const keyExtractor = item => item.rid;
|
||||||
|
|
||||||
class RoomsListView extends React.Component {
|
class RoomsListView extends React.Component {
|
||||||
static navigationOptions = ({ navigation, screenProps }) => {
|
|
||||||
const searching = navigation.getParam('searching');
|
|
||||||
const cancelSearch = navigation.getParam('cancelSearch', () => {});
|
|
||||||
const initSearching = navigation.getParam(
|
|
||||||
'initSearching',
|
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
...themedHeader(screenProps.theme),
|
|
||||||
headerLeft: searching && isAndroid ? (
|
|
||||||
<CustomHeaderButtons left>
|
|
||||||
<Item
|
|
||||||
title='cancel'
|
|
||||||
iconName='cross'
|
|
||||||
onPress={cancelSearch}
|
|
||||||
/>
|
|
||||||
</CustomHeaderButtons>
|
|
||||||
) : (
|
|
||||||
<DrawerButton
|
|
||||||
navigation={navigation}
|
|
||||||
testID='rooms-list-view-sidebar'
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
headerTitle: <RoomsListHeaderView />,
|
|
||||||
headerRight: searching && isAndroid ? null : (
|
|
||||||
<CustomHeaderButtons>
|
|
||||||
{isAndroid ? (
|
|
||||||
<Item
|
|
||||||
title='search'
|
|
||||||
iconName='magnifier'
|
|
||||||
onPress={initSearching}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
<Item
|
|
||||||
title='new'
|
|
||||||
iconName='edit-rounded'
|
|
||||||
onPress={() => navigation.navigate('NewMessageView')}
|
|
||||||
testID='rooms-list-view-create-channel'
|
|
||||||
/>
|
|
||||||
</CustomHeaderButtons>
|
|
||||||
)
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
navigation: PropTypes.object,
|
navigation: PropTypes.object,
|
||||||
user: PropTypes.shape({
|
user: PropTypes.shape({
|
||||||
|
@ -896,4 +851,49 @@ const mapDispatchToProps = dispatch => ({
|
||||||
closeServerDropdown: () => dispatch(closeServerDropdownAction())
|
closeServerDropdown: () => dispatch(closeServerDropdownAction())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
RoomsListView.navigationOptions = ({ route, navigation }) => {
|
||||||
|
const searching = route.params?.searching;
|
||||||
|
const cancelSearch = route.params?.cancelSearch ?? (() => {});
|
||||||
|
const onPressItem = route.params?.onPressItem ?? (() => {});
|
||||||
|
const initSearching = route.params?.initSearching ?? (() => {});
|
||||||
|
|
||||||
|
return {
|
||||||
|
headerLeft: () => (searching && isAndroid ? (
|
||||||
|
<CustomHeaderButtons left>
|
||||||
|
<Item
|
||||||
|
title='cancel'
|
||||||
|
iconName='cross'
|
||||||
|
onPress={cancelSearch}
|
||||||
|
/>
|
||||||
|
</CustomHeaderButtons>
|
||||||
|
) : (
|
||||||
|
<DrawerButton
|
||||||
|
navigation={navigation}
|
||||||
|
testID='rooms-list-view-sidebar'
|
||||||
|
/>
|
||||||
|
)),
|
||||||
|
headerTitle: () => <RoomsListHeaderView />,
|
||||||
|
headerRight: () => (searching && isAndroid ? null : (
|
||||||
|
<CustomHeaderButtons>
|
||||||
|
{isAndroid ? (
|
||||||
|
<Item
|
||||||
|
title='search'
|
||||||
|
iconName='magnifier'
|
||||||
|
onPress={initSearching}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
<Item
|
||||||
|
title='new'
|
||||||
|
iconName='edit-rounded'
|
||||||
|
onPress={() => navigation.navigate('NewMessageStack', {
|
||||||
|
screen: 'NewMessageView',
|
||||||
|
params: { onPressItem }
|
||||||
|
})}
|
||||||
|
testID='rooms-list-view-create-channel'
|
||||||
|
/>
|
||||||
|
</CustomHeaderButtons>
|
||||||
|
))
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(withSplit(RoomsListView)));
|
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(withSplit(RoomsListView)));
|
||||||
|
|
Loading…
Reference in New Issue