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

解决微信小程序调试基础库3.4.10以上版本wx.getSystemInfoSync废弃的问题 #4

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions components/DropDown/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useState, forwardRef, useImperativeHandle, useMemo, useRef } from 'react'
import { View, Text } from '@tarojs/components'
import { Layout, getRect, Absolute } from '@/duxapp'
import { getSystemInfoSync } from '@tarojs/taro'
import { getWindowInfo } from '@tarojs/taro'
import { DuxuiIcon } from '../DuxuiIcon'
import './index.scss'

Expand Down Expand Up @@ -60,7 +60,7 @@ export const DropDown = forwardRef(({

const menuLayout = useCallback(layout => {
(async () => {
const { windowWidth: width, windowHeight: height } = getSystemInfoSync()
const { windowWidth: width, windowHeight: height } = getWindowInfo()
const newposition = { ...clickSize.current, opacity: 1 }
// 此处需要修改
const { left: x, top: y, width: viewWidth, height: viewHeight } = await getRect('.' + currentClass)
Expand Down
4 changes: 2 additions & 2 deletions components/DropDown/index.rn.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useRef, useState, forwardRef, useImperativeHandle } from 'react'
import { TouchableOpacity, View, Text, Dimensions } from 'react-native'
import { getSystemInfoSync } from '@tarojs/taro'
import { getWindowInfo } from '@tarojs/taro'
import { Absolute } from '@/duxapp'
import { DuxuiIcon } from '../DuxuiIcon'
import './index.scss'
Expand Down Expand Up @@ -47,7 +47,7 @@ export const DropDown = forwardRef(({
return
}
view.current.measureInWindow?.((x, y, width, height) => {
const { statusBarHeight } = getSystemInfoSync()
const { statusBarHeight } = getWindowInfo()
setPosition({ left: x, top: y + height + statusBarHeight, opacity: 0 })
setShow(true)
})
Expand Down
4 changes: 2 additions & 2 deletions components/HorseLanternLottery/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Layout, px } from '@/duxapp'
import { useState, isValidElement, useCallback, useRef, useEffect } from 'react'
import { getSystemInfoSync } from '@tarojs/taro'
import { getWindowInfo } from '@tarojs/taro'
import { Column, Row } from '../Flex'

export const HorseLanternLottery = ({
Expand Down Expand Up @@ -158,4 +158,4 @@ const ItemSelf = ({ list, index, Item, select, ...props }) => {
</Column>
}

const toPx = val => getSystemInfoSync().screenWidth / 750 * val
const toPx = val => getWindowInfo().screenWidth / 750 * val
4 changes: 2 additions & 2 deletions components/Interact/ShowMessage.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Text } from '@tarojs/components'
import { useEffect, useRef, useState } from 'react'
import { asyncTimeOut, route, Animated, nextTick, pxNum, currentPage, TopView } from '@/duxapp'
import { getSystemInfoSync } from '@tarojs/taro'
import { getWindowInfo } from '@tarojs/taro'
import { BoxShadow } from '../BoxShadow'
import './ShowMessage.scss'

Expand All @@ -13,7 +13,7 @@ const ShowMessage = ({
onRemove
}) => {

let { statusBarHeight = 0 } = getSystemInfoSync()
let { statusBarHeight = 0 } = getWindowInfo()

if (!statusBarHeight) {
statusBarHeight = 0
Expand Down
4 changes: 2 additions & 2 deletions components/Menu/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useState, createContext, useContext, useRef, forwardRef, useImperativeHandle, useMemo, useEffect } from 'react'
import { Layout, Absolute, duxappTheme, Animated, nextTick, pxNum, asyncTimeOut, transformStyle, px } from '@/duxapp'
import classNames from 'classnames'
import { getSystemInfoSync } from '@tarojs/taro'
import { getWindowInfo } from '@tarojs/taro'
import { Column, Row } from '../Flex'
import { Text } from '../Text'
import { DuxuiIcon } from '../DuxuiIcon'
Expand Down Expand Up @@ -292,7 +292,7 @@ const PullContent = forwardRef(({
}
})

const screenHeight = getSystemInfoSync().screenHeight
const screenHeight = getWindowInfo().screenHeight

return <Absolute>
<Column
Expand Down
4 changes: 2 additions & 2 deletions components/Sign/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from 'react'
import { nextTick, createSelectorQuery, getSystemInfoSync, canvasToTempFilePath } from '@tarojs/taro'
import { nextTick, createSelectorQuery, getWindowInfo, canvasToTempFilePath } from '@tarojs/taro'
import { Canvas } from '@tarojs/components'
import { Layout } from '@/duxapp'
import classNames from 'classnames'
Expand Down Expand Up @@ -32,7 +32,7 @@ export class Sign extends Component {
const ctx = canvas.getContext('2d')

if (process.env.TARO_ENV !== 'h5') {
const dpr = getSystemInfoSync().pixelRatio
const dpr = getWindowInfo().pixelRatio
canvas.width = _res[0].width * dpr
canvas.height = _res[0].height * dpr
ctx.scale(dpr, dpr)
Expand Down
4 changes: 2 additions & 2 deletions components/Svg/components/Svg.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useImperativeHandle, forwardRef, useCallback } from 'react'
import { Canvas, View } from '@tarojs/components'
import { CustomWrapper } from '@/duxapp'
import { getSystemInfoSync, createSelectorQuery, canvasToTempFilePath } from '@tarojs/taro'
import { getWindowInfo, createSelectorQuery, canvasToTempFilePath } from '@tarojs/taro'
import { draw, useForwardEvent } from './Common'
import { SvgComponent } from './SvgComponent'

Expand Down Expand Up @@ -86,7 +86,7 @@ export const Svg = forwardRef(({ children, width, height, ...props }, ref) => {
const ctx = canvas.getContext('2d')

if (process.env.TARO_ENV !== 'h5') {
const dpr = getSystemInfoSync().pixelRatio
const dpr = getWindowInfo().pixelRatio
canvas.width = _res[0].width * dpr
canvas.height = _res[0].height * dpr
ctx.scale(dpr, dpr)
Expand Down