Skip to content

Commit

Permalink
fix: use SystemInfo instead of globalProps
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rdream committed Mar 5, 2025
1 parent 7e654d0 commit 686c99b
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/huge-suns-show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lynx-example/swiper': patch
---

Use `SystemInfo` instead of `globalProps`
2 changes: 1 addition & 1 deletion examples/swiper/src/Components/SafeArea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { CSSProperties } from "@lynx-js/types";
import "./styles.scss";

export default function SafeArea({ children, style }: { children: ReactNode; style?: CSSProperties }) {
const isIOS = lynx.__globalProps.platform === "ios";
const isIOS = SystemInfo.platform === "iOS";

return (
<view class={`safe-area ${isIOS ? "ios" : "android"}`} style={style}>
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/EasingDefault/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/MTSIndicator/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/MTSIndicatorCurrent/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/MTSIndicatorEmpty/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/MTSIndicatorWrong/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
itemHeight = 300,
}: {
data: string[];
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/Swiper/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
duration,
"main-thread:easing": MTEasing,
}: {
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/SwiperEmpty/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SwiperItem } from "./SwiperItem";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/SwiperHooks/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/SwiperMTS/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useUpdateSwiperStyle } from "./useUpdateSwiperStyle";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/swiper/src/UpdateOffset/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SwiperItem } from "./SwiperItem";

export function Swiper({
data,
itemWidth = lynx.__globalProps.screenWidth,
itemWidth = SystemInfo.pixelWidth / SystemInfo.pixelRatio,
}: {
data: string[];
itemWidth?: number;
Expand Down

0 comments on commit 686c99b

Please sign in to comment.