小编Jot*_*nan的帖子

反应原生 ScrollView 项目,顶部和底部具有相同的填充

我正在设计一个滚动组件,看起来像一个图像库。我试图根据设备高度将图像居中,并在顶部和底部使用等效的填充。但根据设备,顶部填充看起来不太好。我需要帮助才能使其在所有设备中保持一致。

为了获取设备的高度和宽度,我正在使用尺寸

  const {width: screenWidth, height: screenHeight} = 
   Dimensions.get('window');
    const width = screenWidth ;
    const height = screenHeight;

<View style={styles.DefaultView}>
          <ScrollView
           maximumZoomScale={1}
           minimumZoomScale={1}
           bouncesZoom={true}
           style={styles.scrollView}
           automaticallyAdjustContentInsets={true}
           pagingEnabled={true}
           horizontal={true}
           showsHorizontalScrollIndicator={false}
           onScroll={this._onScroll}
           contentContainerStyle={{flexGrow : 1, justifyContent : 'center'}}
           >
           {images.map((row, i) => (
              <View key={i}>
                  <Image
                      resizeMode='contain'
                      style={{width, height}}
                      source={{uri: row.src}}
                  />
              </View>
          ))}
           </ScrollView>
        </View>

const styles = StyleSheet.create({
    scrollView: {
        flex: 1,
        flexDirection: 'row',
    },
    DefaultView: {
        flex: 1,
        backgroundColor: '#000',
    },
});
Run Code Online (Sandbox Code Playgroud)

请参阅附图了解当前输出苹果6加

css reactjs react-native

7
推荐指数
2
解决办法
2万
查看次数

通过php imap连接gmail?本地颁发者证书错误

我需要通过IMAP使用连接到Gmail帐户PHP.我有一些工作代码,但在尝试建立连接时,我收到以下错误:

警告:imap_open()[function.imap-open]:无法打开流{imap.gmail.com:993/ssl}[Gmail]/所有邮件/home/demoosiz/public_html/goqlue/email.php在线31
无法连接到Gmail:imap.gmail.com的证书失败:无法获得本地颁发者证书:/ C = US/O = Google Inc/CN = Google Internet Authority

我的代码如下

<?php
    /* connect to gmail */
    $hostname = '{imap.gmail.com:993/ssl}[Gmail]/All Mail';
    $username = 'hidden';
    $password = 'hidden';

    /* try to connect */
    $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());

    /* grab emails */
    $emails = imap_search($inbox,'ALL');

    /* if emails are returned, cycle through each... */
    if($emails) {

      /* begin output var */
      $output = '';

      /* put the newest …
Run Code Online (Sandbox Code Playgroud)

php gmail imap

6
推荐指数
1
解决办法
2万
查看次数

用PHP的谷歌日历api

我需要整合谷歌日历API,以显示我的PHP网站登录用户谷歌日历,与谷歌日历中的所有相同的功能,有任何可能的方法来做到这一点?目前正在使用此https://developers.google.com/google-apps/calendar/ ,请让我知道您的建议.

php google-calendar-api

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

React Native 从状态数组中删除多个项目

我有一个目录,用于存储使用相机拍摄的图像。为了保存图像,我正在使用RNFS。我正在使用react-native-photo-browser

库本身没有任何选项可以从库中删除项目。所以我正在努力实现它

export default class GridGallery extends React.Component{

    static navigationOptions = {
      title: 'Image Gallery',
    };

    constructor(props) {
        super(props)
        this.state = {
          filesList : [],
          mediaSelected: [],
          base64URI: null,
          galleryList: []
        }
    }

    componentDidMount(){
        FileList.list((files) => {

            if(files != null) {

                this.fileUrl = files[0].path;

                files = files.sort((a, b) => {

                    if (a.ctime < b.ctime)
                        return 1;
                    if (a.ctime > b.ctime)
                        return -1;
                    return 0;
                });

                this.setState({
                    filesList: files
                });
            }
            console.warn(this.state.filesList);
            this.getFiles();
        });
      }

    getFiles(){
      //console.warn(this.state.filesList); …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-image

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

three.js在加载的模型上通过物料名称向物料添加边框

是否可以在材料周围添加边框,如图所示,

我可以通过以下代码设置材质颜色

object.traverse( function ( child )
    {
        if ( child instanceof THREE.Mesh )
            child.material.color.setRGB (1, 0, 0);
    });
Run Code Online (Sandbox Code Playgroud)

对象是我加载的3d模型,所以假设应该有一种方法来绘制边框,three.js中是否有任何选项.在此输入图像描述

根据@ shiva的评论,我用以下代码尝试了它来绘制发光效果

if(childObject.material.name=="material4046")
     {
      mesh  = new THREE.Mesh( globalGeomtry, material );
    // mesh.visible = false
    scene.add( mesh );

    console.log(mesh);

    // create a glowMesh
    var glowMesh    = new THREEx.GeometricGlowMesh(mesh);
    mesh.add(glowMesh.object3d);

            // example of customization of the default glowMesh
    var insideUniforms  = glowMesh.insideMesh.material.uniforms;
    insideUniforms.coeficient.value = 2;
    insideUniforms.power.value      = 1.4;
    insideUniforms.glowColor.value.set('red');

    var outsideUniforms = glowMesh.outsideMesh.material.uniforms;
    outsideUniforms.coeficient.value    = 2;
    outsideUniforms.power.value     = 1.4;

    outsideUniforms.glowColor.value.set('red');

     } …
Run Code Online (Sandbox Code Playgroud)

three.js

3
推荐指数
2
解决办法
6591
查看次数

匹配不起作用的弹性搜索日期范围

我正在尝试获取与以下 2 个日期之间的特定字段匹配的记录

{
  "query": {
    "bool": {
         "must": [
            {
              "range": {
                "createdtime": {
                  "gte": "now-1y",
                  "lte": "now",
                  "boost" : 2.0
                }
              }
            },
            {
               "match": {
                  "id": 350403
               }
            }
         ]
    }
  }
    "size" : 10000,
    "from": 0,
    "sort": { "createdtime" : {"order" : "desc"} }  
Run Code Online (Sandbox Code Playgroud)

但它抛出异常,任何人都可以帮助修复它吗?

search elasticsearch elasticsearch-5

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

MFMailComposeViewController canSendMail 始终返回 false

我正在尝试在我的 iOS 应用程序上使用 MFMailComposeViewController 发送电子邮件。

我在 iPhone 默认邮件应用程序中配置了 Gmail 帐户。但每当我尝试发送电子邮件时,我都会收到MFMailComposeViewController canSendMail错误的消息,因此我的代码无法使用给定的抄送和附件打开邮件应用程序

#import <MessageUI/MessageUI.h>
#import "RNMail.h"
#import <React/RCTConvert.h>
#import <React/RCTLog.h>

@implementation RNMail
{
    NSMutableDictionary *_callbacks;
}

- (instancetype)init
{
    if ((self = [super init])) {
        _callbacks = [[NSMutableDictionary alloc] init];
    }
    return self;
}

- (dispatch_queue_t)methodQueue
{
    return dispatch_get_main_queue();
}

+ (BOOL)requiresMainQueueSetup
{
    return YES;
}

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(mail:(NSDictionary *)options
                  callback: (RCTResponseSenderBlock)callback)
{
    if ([MFMailComposeViewController canSendMail])
    {
        MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
        mail.mailComposeDelegate = self;
        _callbacks[RCTKeyForInstance(mail)] = callback;

        if …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios mfmailcomposeviewcontroller ios12

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

三.js 无法使用 Raycaster 选择对象

我有以下函数来获取选定的对象,所以我的函数在这里

function onMouseDown(event) {
    console.log(event);
    event.preventDefault();

    mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
    mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
    // find intersections

    var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
    projector.unprojectVector( vector, camera );


    var pLocal = new THREE.Vector3(0, 0, -1);
    var pWorld = pLocal.applyMatrix4(camera.matrixWorld);
    var ray = new THREE.Raycaster(pWorld, vector.sub(pWorld).normalize());




    ray.set( camera.position, vector.sub( camera.position ).normalize() );
    var intersects = ray.intersectObjects( scene.children );
    //console.log(intersects);
    console.log(scene.children);
    if ( intersects.length > …
Run Code Online (Sandbox Code Playgroud)

javascript jquery three.js

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

HighChart 在点击图例上隐藏其他系列

单击图例时,我需要在 HighChart(折线图)中隐藏其他系列,所以我尝试了一些当前隐藏其他系列线的方法,但是当我尝试单击相同的图例时,它再次显示其他系列,这是不正确的.

$(function () {
    var chart;

    $(document).ready(function() {

        chart = new Highcharts.Chart({

            chart: {

                renderTo: 'container',

                type: 'line',

                marginRight: 130,

                marginBottom: 25

            },
            plotOptions: {
        line: {

                events: {
                    legendItemClick: function () {
                        chart.yAxis[0].addPlotLine({
                        value : 7.5,
                        color : 'green',
                        dashStyle : 'shortdash',
                        width : 2,
                        label : {
                            text : 'My PlotLine'
                        }
                    });

                     if (!this.visible)
                     return true;

                    var seriesIndex = this.index;
                    var series = this.chart.series;

                    for (var i = 0; i < series.length; i++)
                    {
                        if (series[i].index …
Run Code Online (Sandbox Code Playgroud)

javascript jquery highcharts

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

Php 脚本无法在 Wamp 本地主机上运行,​​但在远程服务器上运行正常

当我index.php本地主机上打开时,页面显示完整或 php 错误,例如(身份不明的变量等),并且网页根本无法工作。然而,完全相同的 php 文件可以在远程服务器上运行(例如 Godaddy)

文件index.php开头为

<?
require_once ('templates/header.php');
?>
<div class='grid_12'>
<table>

<div id="form" > and son on....
Run Code Online (Sandbox Code Playgroud)

文件header.php开头为:

<?php
session_start();
include('classes/secure.class.php'); // include the class
$secure = new secure(); // load the class
$secure->secureGlobals(); // run the main class function

require_once ('config.php');
require_once ('functions.php');
require_once ('templates/commonheader.php');
require_once ('lang.php');

header('Content-type: text/html; charset=$charset');

?> and so on...
Run Code Online (Sandbox Code Playgroud)

我认为PHP SESSIONSlocalhost有问题我不知道为什么相同的脚本在localhost中不起作用。任何帮助表示赞赏。

J。

php session wamp localhost

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