小编Luc*_*eto的帖子

反应本机下拉选择器默认值

有没有人有库react-native-dropdown-picker使用的hooks e函数中使用的默认值的示例,或者另一个使这个msm函数更简单的库。

导出默认函数 OrphanageData() {

const [date, setDate] = useState(new Date())
const [value, setValue] = useState();
const [items, setItems] = useState([{}]);
let controller;
Run Code Online (Sandbox Code Playgroud)

返回 (

<>
     <StatusBar backgroundColor="#15c3d6"/>

    <ScrollView style={styles.container} contentContainerStyle={{ padding: 24 }}>
    
        <Text style={styles.title}>Compras</Text>
        

        <Text style={styles.label}> ID - Brinco</Text>
        <TextInput
            style={styles.input}
        />

    <DropDownPicker
        items={items}
        controller={instance => controller = instance}
        onChangeList={(items, callback) => {
            new Promise((resolve, reject) => resolve(setItems(items)))
                .then(() => callback())
                .catch(() => {});
        }}
    
        defaultValue={value}
        onChangeItem={item => setValue(item.value)}
    />    

      

        <RectButton style={styles.nextButton} onPress={() => {}}>
            <Text style={styles.nextButtonText}>Cadastrar</Text>
        </RectButton> …
Run Code Online (Sandbox Code Playgroud)

hook function react-native

5
推荐指数
1
解决办法
9581
查看次数

如何基于透明python合并两个图像

我需要加入两个图像,其中基本图像具有透明背景,我已经尝试使用

图片01

在此输入图像描述

图像和照片我需要将她放在空白处的第二个图像中

在此输入图像描述

预期结果和这个

在此输入图像描述

import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

dim = (425, 425)

apple = mpimg.imread('image.png')
apple = cv2.resize(apple, dim)

banana = mpimg.imread('image2.png')
banana = cv2.resize(banana, dim)


_ = plt.imshow(apple)
_ = plt.show()

_ = plt.imshow(banana)
_ = plt.show()

list_images = [apple, banana]

def blend(list_images): # Blend images equally.

    equal_fraction = 1.0 / (len(list_images))

    output = np.zeros_like(list_images[0])

    for img in list_images:
        output = output + img * equal_fraction

    output = output.astype(np.uint8) …
Run Code Online (Sandbox Code Playgroud)

python opencv

1
推荐指数
1
解决办法
558
查看次数

标签 统计

function ×1

hook ×1

opencv ×1

python ×1

react-native ×1