Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with images not rendering #3

Merged
merged 1 commit into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ post_install do |_installer|
'_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules', '_initializeModules:(NSArray<Class> *)modules')
find_and_replace('../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm',
'RCTBridgeModuleNameForClass(module))', 'RCTBridgeModuleNameForClass(Class(module)))')
find_and_replace('../node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m',
'_currentFrame.CGImage;', '_currentFrame.CGImage ;} else { [super displayLayer:layer];')
end

def find_and_replace(dir, findstr, replacestr)
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,6 @@ SPEC CHECKSUMS:
SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21
Yoga: 02036f6383c0008edb7ef0773a0e6beb6ce82bd1

PODFILE CHECKSUM: eb37df8267dd7a43f431c689a61309d62782ea09
PODFILE CHECKSUM: e9c5b4bdcdc84edc44f3a2bd5f1c5d4c1ddd89b4

COCOAPODS: 1.10.1
16 changes: 7 additions & 9 deletions src/contexts/ListingContext.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import React, { createContext, useReducer } from 'react';
import React, {createContext, useReducer} from 'react';

export const ListingContext = createContext({});

const initialState = {
fetchingListing: true,
listing: {},
}
};

const reducer = (state, action) => {
switch (action.type) {
case 'GET_LISTING': {
return {
...state,
fetchingListing: true
fetchingListing: true,
};
}
case 'GET_LISTING_SUCCESS': {
const {
listing,
} = action;
const {listing} = action;
return {
...state,
listing,
Expand All @@ -28,10 +26,10 @@ const reducer = (state, action) => {
case 'GET_LISTING_FAILURE':
return {
...state,
fetchingListing: false
fetchingListing: false,
};
case 'NO_LISTING': {
return { ...state, listing: {}, fetchingListing: false };
return {...state, listing: {}, fetchingListing: false};
}
default:
return state;
Expand All @@ -45,4 +43,4 @@ export const ListingProvider = props => {
{props.children}
</ListingContext.Provider>
);
}
};
3 changes: 2 additions & 1 deletion src/navigators/NewOrderStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import {Icon} from 'react-native-ui-kitten';
import {TouchableOpacity} from 'react-native';
import {createStackNavigator} from 'react-navigation-stack';
import {Header, HeaderBackButton} from 'react-navigation-stack';

import NewOrder from '../screens/NewOrder';
import CameraOrder from '../screens/CameraOrder';
Expand Down Expand Up @@ -52,8 +51,10 @@ export default createStackNavigator({
screen: CameraRollSelect,
navigationOptions: {
headerStyle: {
backgroundColor: '#0079BF',
elevation: 0,
},
headerTintColor: '#fff',
},
},
});
44 changes: 29 additions & 15 deletions src/screens/CameraRollSelect.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React, {useState} from 'react';
import {StyleSheet, Text, View} from 'react-native';
import {StyleSheet, Text, View, TouchableOpacity} from 'react-native';
import CameraRollPicker from 'react-native-camera-roll-picker';
import {Icon} from 'react-native-ui-kitten';

const CameraRollSelect = () => {
const MAX = 3;

const CameraRollSelect = ({navigation}) => {
const [selectedImages, setSelectedImages] = useState([]);
const [num, setNum] = useState(0);

Expand All @@ -19,13 +22,14 @@ const CameraRollSelect = () => {
return (
<View style={styles.container}>
<View style={styles.content}>
<Text style={styles.text}>
<Text style={styles.bold}> {num} </Text> images has been selected
<Text style={styles.bold}>
{' '}
{num}/{MAX} selected
</Text>
</View>
<CameraRollPicker
groupTypes="All"
maximum={3}
maximum={MAX}
selected={selectedImages}
imagesPerRow={3}
callback={getSelectedImages}
Expand All @@ -35,30 +39,40 @@ const CameraRollSelect = () => {
);
};

CameraRollSelect.navigationOptions = ({navigation}) => {
return {
headerRight: () => (
<TouchableOpacity onPress={() => navigation.navigate('NewOrderScreen')}>
<Icon
name="checkmark-outline"
fill="#fff"
width={35}
height={35}
style={{marginRight: 20}}
/>
</TouchableOpacity>
),
};
};

export default CameraRollSelect;

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F6AE2D',
backgroundColor: '#0079BF',
},
content: {
marginTop: 15,
height: 50,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
flexWrap: 'wrap',
},
text: {
text: {},
bold: {
fontWeight: 'bold',
fontSize: 16,
alignItems: 'center',
color: '#fff',
},
bold: {
fontWeight: 'bold',
},
info: {
fontSize: 12,
},
});
7 changes: 1 addition & 6 deletions src/screens/NewOrder.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React, {useEffect, useContext, useState} from 'react';
import {
StyleSheet,
ActivityIndicator,
View,
TouchableOpacity,
} from 'react-native';
import {StyleSheet, ActivityIndicator, TouchableOpacity} from 'react-native';
import {StackActions} from 'react-navigation';
import normalize from 'json-api-normalizer';
import build from 'redux-object';
Expand Down