Skip to content

Commit add8dfe

Browse files
authored
Merge pull request #1 from RakaDoank/main
Update 1.0.5
2 parents 150258f + 82cfa4b commit add8dfe

69 files changed

Lines changed: 1551 additions & 74 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-storybook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
branches:
66
- deploy-storybook
7-
pull_request:
7+
pull_request_target:
88
branches:
99
- deploy-storybook
10+
types:
11+
- closed
1012

1113
jobs:
1214
deploy-storybook:

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
branches:
66
- release
7-
pull_request:
7+
pull_request_target:
88
branches:
99
- release
10+
types:
11+
- closed
1012

1113
jobs:
1214
release:

packages/carbon-react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@audira/carbon-react-native",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"license": "MIT",
55
"homepage": "https://rakadoank.github.io/carbon-react-native",
66
"repository": "https://github.com/RakaDoank/carbon-react-native",

packages/carbon-react-native/src/_internal/contexts/global-config/GlobalConfigContext.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import {
22
createContext,
33
} from "react"
44

5+
import {
6+
I18nManager,
7+
} from "react-native"
8+
59
import type {
610
NotificationColor,
711
} from "../../../components/notification/NotificationColor"
@@ -26,5 +30,5 @@ export const GlobalConfigContext = createContext<GlobalConfigContext>({
2630
android_buttonRippleEffect: true,
2731
notificationColor: "high_contrast",
2832
toastDuration: 5000,
29-
rtl: false,
33+
rtl: I18nManager.isRTL,
3034
})

packages/carbon-react-native/src/_internal/providers/global-config/GlobalConfigProvider.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import {
2+
I18nManager,
3+
} from "react-native"
4+
15
import {
26
GlobalConfigContext,
37
} from "../../contexts/global-config"
@@ -6,14 +10,20 @@ import type {
610
GlobalConfigProviderProps,
711
} from "./GlobalConfigProviderProps"
812

13+
const isRtl = I18nManager.isRTL
14+
915
export function GlobalConfigProvider({
10-
android_buttonRippleEffect,
11-
notificationColor,
12-
toastDuration,
13-
rtl,
16+
android_buttonRippleEffect = true,
17+
notificationColor = "high_contrast",
18+
toastDuration = 5000,
19+
rtl: rtlProp,
1420
children,
1521
}: GlobalConfigProviderProps) {
1622

23+
const
24+
rtl =
25+
rtlProp ?? isRtl
26+
1727
return (
1828
<GlobalConfigContext.Provider
1929
value={{

packages/carbon-react-native/src/_internal/providers/global-config/GlobalConfigProviderProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import type {
22
GlobalConfigContext,
33
} from "../../contexts"
44

5-
export interface GlobalConfigProviderProps extends GlobalConfigContext {
5+
export interface GlobalConfigProviderProps extends Partial<GlobalConfigContext> {
66
children?: React.ReactNode,
77
}

packages/carbon-react-native/src/carbon-react-native/CarbonReactNative.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import type {
99
} from "./CarbonReactNativeProps"
1010

1111
export function CarbonReactNative({
12-
// GlobalConfigProviderProps
13-
android_buttonRippleEffect = true,
14-
notificationColor = "high_contrast",
15-
toastDuration = 5000,
16-
rtl = false,
17-
18-
// ThemeProviderProps
12+
// +++ GlobalConfigProviderProps +++
13+
android_buttonRippleEffect,
14+
notificationColor,
15+
toastDuration,
16+
rtl,
17+
// --- GlobalConfigProviderProps ---
18+
// +++ ThemeProviderProps +++
1919
colorScheme,
20-
20+
// --- ThemeProviderProps ---
2121
children,
2222
}: CarbonReactNativeProps) {
2323

packages/carbon-react-native/src/carbon-react-native/CarbonReactNativeProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import type {
33
ThemeProviderProps,
44
} from "../_internal/providers"
55

6-
export interface CarbonReactNativeProps extends Partial<GlobalConfigProviderProps>, ThemeProviderProps {
6+
export interface CarbonReactNativeProps extends GlobalConfigProviderProps, ThemeProviderProps {
77
}

packages/carbon-react-native/src/components/box/Box.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ import type {
2121
BoxRef,
2222
} from "./BoxRef"
2323

24+
/**
25+
* This component is a basic React Native `View` to solve
26+
* RTL support for component level.
27+
*
28+
* You may use this if your app provides custom localization options.
29+
*/
2430
export const Box = forwardRef<BoxRef, BoxProps>(
2531
function Box(
2632
{

packages/carbon-react-native/src/components/button/base/Base.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const Base = forwardRef<BaseRef, BaseProps>(
7373
getIconSize(size),
7474

7575
iconMarginStyle =
76-
mapIconMarginStyle[`${!!globalConfigContext.rtl}`][`${!!text}`]
76+
mapIconMarginStyle[`${!!text}`]
7777

7878
return (
7979
<Pressable
@@ -172,11 +172,8 @@ const
172172
maxHeight: 48,
173173
},
174174

175-
iconMarginLTR: {
176-
marginLeft: Spacing.spacing_07,
177-
},
178-
iconMarginRTL: {
179-
marginRight: Spacing.spacing_07,
175+
iconMargin: {
176+
marginStart: Spacing.spacing_07,
180177
},
181178

182179
inlineLoading: {
@@ -241,19 +238,11 @@ const
241238
},
242239

243240
mapIconMarginStyle: {
244-
[RTL in `${boolean}`]: {
245-
[HasText in `${boolean}`]: ViewProps["style"]
246-
}
241+
[HasText in `${boolean}`]: ViewProps["style"]
247242
} =
248243
{
249-
false: {
250-
false: null,
251-
true: baseStyle.iconMarginLTR,
252-
},
253-
true: {
254-
false: null,
255-
true: baseStyle.iconMarginRTL,
256-
},
244+
false: null,
245+
true: baseStyle.iconMargin,
257246
},
258247

259248
mapStyleInButtonGroup: {

0 commit comments

Comments
 (0)