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

Add footer and bottom buttons #103

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e7c60c8
Merge branch 'features/redux'
crabbynguyen Oct 16, 2020
9905384
build(deps-dev): bump @types/react-native from 0.62.13 to 0.63.25
dependabot-preview[bot] Oct 16, 2020
dcb5649
Merge pull request #2 from Simicart/dependabot/npm_and_yarn/types/rea…
crabbynguyen Oct 16, 2020
c5d6337
Merge pull request #21 from Simicart/develop
alitonia Oct 22, 2020
7d65374
build(deps-dev): bump eslint-config-prettier from 6.12.0 to 6.14.0
dependabot-preview[bot] Oct 22, 2020
5d2728f
build(deps-dev): bump @types/react-native from 0.63.25 to 0.63.27
dependabot-preview[bot] Oct 22, 2020
0bba534
build(deps-dev): bump commitlint from 8.3.5 to 11.0.0
dependabot-preview[bot] Oct 22, 2020
64affc1
build(deps-dev): bump jest from 26.5.2 to 26.6.0
dependabot-preview[bot] Oct 22, 2020
d4f9f24
Merge pull request #24 from Simicart/develop
alitonia Oct 22, 2020
36b59ca
Merge pull request #25 from Simicart/develop
alitonia Oct 22, 2020
301f283
Merge pull request #19 from Simicart/dependabot/npm_and_yarn/eslint-c…
alitonia Oct 22, 2020
cc12f3c
Merge pull request #18 from Simicart/dependabot/npm_and_yarn/types/re…
alitonia Oct 22, 2020
5c13616
Merge pull request #14 from Simicart/dependabot/npm_and_yarn/jest-26.6.0
alitonia Oct 22, 2020
c493b31
Merge branch 'master' into dependabot/npm_and_yarn/commitlint-11.0.0
alitonia Oct 22, 2020
4160eaa
Merge pull request #11 from Simicart/dependabot/npm_and_yarn/commitli…
alitonia Oct 22, 2020
928be5d
Merge pull request #43 from Simicart/develop
alitonia Oct 26, 2020
b13da71
Update README.md
crabbynguyen Oct 28, 2020
258d595
Add license scan report and status
fossabot Nov 3, 2020
0c935fb
Merge pull request #56 from fossabot/add-license-scan-badge
crabbynguyen Nov 3, 2020
3522949
Merge branch 'develop'
alitonia Nov 9, 2020
bebd93e
Merge branch 'develop'
alitonia Nov 9, 2020
8ad4f1e
Merge branch 'develop'
alitonia Nov 9, 2020
c4a4796
Merge branch 'develop'
alitonia Nov 9, 2020
7335b81
Merge branch 'develop'
alitonia Nov 9, 2020
fe1ae40
Merge branch 'develop'
alitonia Nov 9, 2020
f0b9321
Merge branch 'develop'
alitonia Nov 9, 2020
d1933e8
fix: remove buggy flow
alitonia Nov 9, 2020
afc6c75
add bottom buttons
sonduong272 Mar 9, 2021
e4fdd68
add bottom buttons
sonduong272 Mar 9, 2021
a0a68e8
Merge branch 'develop' into pr/footer
sonduong272 Mar 9, 2021
656fa76
Update package.json
sonduong272 Mar 9, 2021
74bccc4
Update index.js
sonduong272 Mar 9, 2021
9278209
update build.gradle to enable vector icons
sonduong272 Mar 9, 2021
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
41 changes: 0 additions & 41 deletions .github/workflows/lively_issue_corner.yml

This file was deleted.

12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# RN-Ecommerce
# RN-Ecommerce-Graphql
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSimicart%2Frn-ecommerce-graphql.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSimicart%2Frn-ecommerce-graphql?ref=badge_shield)


__RN-Ecommerce__ is a React-Native library for building a customized Ecommerce app.
Everythings you need to build a Magento mobile app.


### How to use:

Expand All @@ -11,4 +13,8 @@ _Currently in development_...

We are grateful if you decide to contribute to this project. Please refer to [the contributing guideline](https://github.com/Simicart/rn-ecommerce-graphql/blob/master/CONTRIBUTING.md) for detailed information.

If there's any problem, feel free to open an [issue](https://github.com/Simicart/rn-ecommerce-graphql/issues).
If there's any problem, feel free to open an [issue](https://github.com/Simicart/rn-ecommerce-graphql/issues).


## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSimicart%2Frn-ecommerce-graphql.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FSimicart%2Frn-ecommerce-graphql?ref=badge_large)
1 change: 1 addition & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,4 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
24 changes: 22 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,43 @@
import 'react-native-gesture-handler';

import React from 'react';
import { AppRegistry } from 'react-native';
import { AppRegistry, ScrollView, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
import { AppComposite } from 'simicart';
import AppRouter from './route/navigation';

import { name as appName } from './app.json';
import App from './src/App';
import Ionicons from 'react-native-vector-icons/Ionicons';
import AppStateDisplay from './src/test_component/appStateDisplay.js';
import CatalogStateDisplay from './src/test_component/catalogStateDisplay.js';
import CartStateDisplay from './src/test_component/cartStateDisplay';
import UserStateDisplay from './src/test_component/userStateDisplay.js';
import CheckoutStateDisplay from './src/test_component/checkoutStateDisplay.js';
import TabBar from './src/components/TabBar/tabBar.js'
import counterSlice from './src/customReducer/counterSlice';
import Config from './src/Helper/config';

const Drawer = createDrawerNavigator();
const Tab = createBottomTabNavigator()

function Index() {
return (
<NavigationContainer>
<AppComposite customReducer={counterSlice} apiBase={Config.merchant_url}>
<AppRouter />
<Tab.Navigator tabBar={props => <TabBar {...props}/>}>
<Tab.Screen name={'Cart'} component={CartStateDisplay}/>
<Tab.Screen name={'App'} component={AppStateDisplay} options={{tabBarLabel: 'Home'}}/>
<Tab.Screen name={'Catalog'} component={CatalogStateDisplay} />
<Tab.Screen name={'User'} component={UserStateDisplay} options={{tabBarLabel: 'Chau Bui'}}/>
<Tab.Screen name={'Checkout'} component={CheckoutStateDisplay} />
</Tab.Navigator>
</AppComposite>
</NavigationContainer>
);
}

AppRegistry.registerComponent(appName, () => Index);

4 changes: 4 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@
"dependencies": {
"@apollo/client": "^3.2.5",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/bottom-tabs": "^5.11.8",
"@react-navigation/drawer": "^5.9.3",
"@react-navigation/native": "^5.7.6",
"@react-navigation/stack": "^5.12.5",
"@reduxjs/toolkit": "^1.4.0",
"graphql": "^15.3.0",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-feather": "^1.0.2",
"react-native-gesture-handler": "^1.8.0",
"react-native-reanimated": "^1.13.1",
"react-native-safe-area-context": "^3.1.8",
"react-native-screens": "^2.13.0",
"react-native-svg": "^12.1.0",
"react-native-vector-icons": "^8.1.0",
"react-redux": "^7.2.2",
"rxjs": "^6.6.3"
},
Expand Down
105 changes: 105 additions & 0 deletions example/src/components/TabBar/tabBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import React from 'react'
import { View, Text, TouchableOpacity } from 'react-native'
import Ionicons from 'react-native-vector-icons/Ionicons'

const activeTintColor = '#749867'
const inactiveTintColor = 'gray'

function TabBar({ state, descriptors, navigation }) {
return (
<View style={{
flexDirection: 'row',
backgroundColor:"#DEDEDE",
paddingTop: 5,
paddingBottom: 5,
justifyContent:"center",
alignItems:"center"
}}>
{state.routes.map((route, index) => {
const { options } = descriptors[route.key];
const label =
options.tabBarLabel !== undefined
? options.tabBarLabel
: options.title !== undefined
? options.title
: route.name;

const isFocused = state.index === index;

let cartCounter
if(route.name === 'Cart') {
const count = 3;
cartCounter = count ?
<View
style={{
position: 'absolute',
backgroundColor: '#D23B1F',
zIndex: 1,
padding: 1,
height: 11,
width: 11,
borderRadius: 50,
alignItems: 'center',
justifyContent: 'center',
left: 37
}}
>
<Text style={{fontSize: 9, color: 'white'}}>{count}</Text>
</View>
: null
}

let iconName;
if (route.name === 'App') {
iconName = isFocused ? 'home-sharp' : 'home-outline';
} else if (route.name === 'Cart') {
iconName = isFocused ? 'cart' : 'cart-outline';
} else if (route.name === 'Catalog') {
iconName = isFocused ? 'list' : 'list-outline';
} else if (route.name === 'User') {
iconName = isFocused ? 'person' : 'person-outline';
} else if (route.name === 'Checkout') {
iconName = isFocused ? 'card' : 'card-outline';
}

const onPress = () => {
const event = navigation.emit({
type: 'tabPress',
target: route.key,
});

if (!isFocused && !event.defaultPrevented) {
navigation.navigate(route.name);
}
};

const onLongPress = () => {
navigation.emit({
type: 'tabLongPress',
target: route.key,
});
};

return (
<TouchableOpacity
accessibilityRole="button"
accessibilityStates={isFocused ? ['selected'] : []}
accessibilityLabel={options.tabBarAccessibilityLabel}
testID={options.tabBarTestID}
onPress={onPress}
onLongPress={onLongPress}
style={{ flex: 1, alignItems:"center" }}
>
{cartCounter}
<Ionicons name={iconName} size={20} color={isFocused ? activeTintColor : inactiveTintColor}/>
<Text style={{ color: isFocused ? activeTintColor : inactiveTintColor }}>
{label}
</Text>
</TouchableOpacity>
);
})}
</View>
);
}

export default TabBar
18 changes: 15 additions & 3 deletions example/src/test_component/appStateDisplay.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { View } from 'react-native';
import { ScrollView } from 'react-native';
import { useAppContext } from 'simicart';
import ColorfulButton from '../visualComponent/ColorfulButton';
import StateDisplayer from './stateDisplayer';
Expand All @@ -19,7 +19,7 @@ function AppStateDisplay(props) {
} = appApi;

return (
<View>
<ScrollView>
<StateDisplayer data={appState} title={'App'} />
<ColorfulButton
title={'stack'}
Expand Down Expand Up @@ -70,7 +70,19 @@ function AppStateDisplay(props) {
setPageLoading(false);
}}
/>
</View>
<ColorfulButton
title={'SET_PAGE_LOADING true'}
onPress={() => {
setPageLoading(true);
}}
/>
<ColorfulButton
title={'SET_PAGE_LOADING false'}
onPress={() => {
setPageLoading(false);
}}
/>
</ScrollView>
);
}

Expand Down
2 changes: 1 addition & 1 deletion example/src/test_component/cartStateDisplay.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ScrollView } from 'react-native';
import { ScrollView, Text } from 'react-native';
import StateDisplayer from './stateDisplayer.js';
import ColorfulButton from '../visualComponent/ColorfulButton.js';

Expand Down
3 changes: 2 additions & 1 deletion example/src/test_component/catalogStateDisplay.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState } from 'react';
import { ScrollView, View } from 'react-native';
import { ScrollView } from 'react-native';
import StateDisplayer from './stateDisplayer';
import ColorfulButton from '../visualComponent/ColorfulButton';

import { useCatalogContext } from 'simicart';
import { getRandomLargeNumber } from '../Helper/getRandomLargeNumber';

Expand Down
3 changes: 2 additions & 1 deletion example/src/test_component/checkoutStateDisplay.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState } from 'react';
import { ScrollView, View } from 'react-native';
import { ScrollView } from 'react-native';
import { useCheckoutContext } from 'simicart';
import StateDisplayer from './stateDisplayer.js';
import ColorfulButton from '../visualComponent/ColorfulButton.js';

import { getRandomLargeNumber } from '../Helper/getRandomLargeNumber.js';

function CheckoutStateDisplay(props) {
Expand Down
3 changes: 2 additions & 1 deletion example/src/test_component/userStateDisplay.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState } from 'react';
import { ScrollView, View } from 'react-native';
import { ScrollView } from 'react-native';
import { useUserContext } from 'simicart';
import StateDisplayer from './stateDisplayer.js';
import ColorfulButton from '../visualComponent/ColorfulButton.js';

import { getRandomLargeNumber } from '../Helper/getRandomLargeNumber.js';

function UserStateDisplay(props) {
Expand Down
Loading