Skip to content

Commit c909f2e

Browse files
feat: add updateInsets public function to uniwind (#211)
1 parent 37e3c31 commit c909f2e

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

packages/uniwind/src/core/config/config.common.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Appearance, Platform } from 'react-native'
1+
import { Appearance, Insets, Platform } from 'react-native'
22
import { ColorScheme, StyleDependency, UniwindConfig } from '../../types'
33
import { UniwindListener } from '../listener'
44
import { CSSVariables, GenerateStyleSheetsCallback } from '../types'
@@ -86,6 +86,11 @@ export class UniwindConfigBuilder {
8686
variables
8787
}
8888

89+
updateInsets(insets: Insets) {
90+
// noop
91+
insets
92+
}
93+
8994
protected __reinit(_: GenerateStyleSheetsCallback, themes: Array<string>) {
9095
this.themes = themes
9196
}

packages/uniwind/src/core/config/config.native.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { formatHex, formatHex8, parse } from 'culori'
2+
import { Insets } from 'react-native'
23
import { StyleDependency } from '../../types'
34
import { UniwindListener } from '../listener'
45
import { Logger } from '../logger'
@@ -65,6 +66,14 @@ class UniwindConfigBuilder extends UniwindConfigBuilderBase {
6566
UniwindListener.notify([StyleDependency.Variables])
6667
}
6768
}
69+
70+
updateInsets(insets: Insets) {
71+
UniwindStore.runtime.insets.bottom = insets.bottom ?? 0
72+
UniwindStore.runtime.insets.top = insets.top ?? 0
73+
UniwindStore.runtime.insets.left = insets.left ?? 0
74+
UniwindStore.runtime.insets.right = insets.right ?? 0
75+
UniwindListener.notify([StyleDependency.Insets])
76+
}
6877
}
6978

7079
export const Uniwind = new UniwindConfigBuilder()

0 commit comments

Comments
 (0)